lastTokenPos)
- lastTokenPos = thisTokenPos;
- }
- return lastTokenPos;
- }
-}
-
-Ajax.Autocompleter = Class.create();
-Object.extend(Object.extend(Ajax.Autocompleter.prototype, Autocompleter.Base.prototype), {
- initialize: function(element, update, url, options) {
- this.baseInitialize(element, update, options);
- this.options.asynchronous = true;
- this.options.onComplete = this.onComplete.bind(this);
- this.options.defaultParams = this.options.parameters || null;
- this.url = url;
- },
-
- getUpdatedChoices: function() {
- entry = encodeURIComponent(this.options.paramName) + '=' +
- encodeURIComponent(this.getToken());
-
- this.options.parameters = this.options.callback ?
- this.options.callback(this.element, entry) : entry;
-
- if(this.options.defaultParams)
- this.options.parameters += '&' + this.options.defaultParams;
-
- new Ajax.Request(this.url, this.options);
- },
-
- onComplete: function(request) {
- this.updateChoices(request.responseText);
- }
-
-});
-
-// The local array autocompleter. Used when you'd prefer to
-// inject an array of autocompletion options into the page, rather
-// than sending out Ajax queries, which can be quite slow sometimes.
-//
-// The constructor takes four parameters. The first two are, as usual,
-// the id of the monitored textbox, and id of the autocompletion menu.
-// The third is the array you want to autocomplete from, and the fourth
-// is the options block.
-//
-// Extra local autocompletion options:
-// - choices - How many autocompletion choices to offer
-//
-// - partialSearch - If false, the autocompleter will match entered
-// text only at the beginning of strings in the
-// autocomplete array. Defaults to true, which will
-// match text at the beginning of any *word* in the
-// strings in the autocomplete array. If you want to
-// search anywhere in the string, additionally set
-// the option fullSearch to true (default: off).
-//
-// - fullSsearch - Search anywhere in autocomplete array strings.
-//
-// - partialChars - How many characters to enter before triggering
-// a partial match (unlike minChars, which defines
-// how many characters are required to do any match
-// at all). Defaults to 2.
-//
-// - ignoreCase - Whether to ignore case when autocompleting.
-// Defaults to true.
-//
-// It's possible to pass in a custom function as the 'selector'
-// option, if you prefer to write your own autocompletion logic.
-// In that case, the other options above will not apply unless
-// you support them.
-
-Autocompleter.Local = Class.create();
-Autocompleter.Local.prototype = Object.extend(new Autocompleter.Base(), {
- initialize: function(element, update, array, options) {
- this.baseInitialize(element, update, options);
- this.options.array = array;
- },
-
- getUpdatedChoices: function() {
- this.updateChoices(this.options.selector(this));
- },
-
- setOptions: function(options) {
- this.options = Object.extend({
- choices: 10,
- partialSearch: true,
- partialChars: 2,
- ignoreCase: true,
- fullSearch: false,
- selector: function(instance) {
- var ret = []; // Beginning matches
- var partial = []; // Inside matches
- var entry = instance.getToken();
- var count = 0;
-
- for (var i = 0; i < instance.options.array.length &&
- ret.length < instance.options.choices ; i++) {
-
- var elem = instance.options.array[i];
- var foundPos = instance.options.ignoreCase ?
- elem.toLowerCase().indexOf(entry.toLowerCase()) :
- elem.indexOf(entry);
-
- while (foundPos != -1) {
- if (foundPos == 0 && elem.length != entry.length) {
- ret.push("" + elem.substr(0, entry.length) + "" +
- elem.substr(entry.length) + "");
- break;
- } else if (entry.length >= instance.options.partialChars &&
- instance.options.partialSearch && foundPos != -1) {
- if (instance.options.fullSearch || /\s/.test(elem.substr(foundPos-1,1))) {
- partial.push("" + elem.substr(0, foundPos) + "" +
- elem.substr(foundPos, entry.length) + "" + elem.substr(
- foundPos + entry.length) + "");
- break;
- }
- }
-
- foundPos = instance.options.ignoreCase ?
- elem.toLowerCase().indexOf(entry.toLowerCase(), foundPos + 1) :
- elem.indexOf(entry, foundPos + 1);
-
- }
- }
- if (partial.length)
- ret = ret.concat(partial.slice(0, instance.options.choices - ret.length))
- return "";
- }
- }, options || {});
- }
-});
-
-// AJAX in-place editor
-//
-// see documentation on http://wiki.script.aculo.us/scriptaculous/show/Ajax.InPlaceEditor
-
-// Use this if you notice weird scrolling problems on some browsers,
-// the DOM might be a bit confused when this gets called so do this
-// waits 1 ms (with setTimeout) until it does the activation
-Field.scrollFreeActivate = function(field) {
- setTimeout(function() {
- Field.activate(field);
- }, 1);
-}
-
-Ajax.InPlaceEditor = Class.create();
-Ajax.InPlaceEditor.defaultHighlightColor = "#FFFF99";
-Ajax.InPlaceEditor.prototype = {
- initialize: function(element, url, options) {
- this.url = url;
- this.element = $(element);
-
- this.options = Object.extend({
- paramName: "value",
- okButton: true,
- okText: "ok",
- cancelLink: true,
- cancelText: "cancel",
- savingText: "Saving...",
- clickToEditText: "Click to edit",
- okText: "ok",
- rows: 1,
- onComplete: function(transport, element) {
- new Effect.Highlight(element, {startcolor: this.options.highlightcolor});
- },
- onFailure: function(transport) {
- alert("Error communicating with the server: " + transport.responseText.stripTags());
- },
- callback: function(form) {
- return Form.serialize(form);
- },
- handleLineBreaks: true,
- loadingText: 'Loading...',
- savingClassName: 'inplaceeditor-saving',
- loadingClassName: 'inplaceeditor-loading',
- formClassName: 'inplaceeditor-form',
- highlightcolor: Ajax.InPlaceEditor.defaultHighlightColor,
- highlightendcolor: "#FFFFFF",
- externalControl: null,
- submitOnBlur: false,
- ajaxOptions: {},
- evalScripts: false
- }, options || {});
-
- if(!this.options.formId && this.element.id) {
- this.options.formId = this.element.id + "-inplaceeditor";
- if ($(this.options.formId)) {
- // there's already a form with that name, don't specify an id
- this.options.formId = null;
- }
- }
-
- if (this.options.externalControl) {
- this.options.externalControl = $(this.options.externalControl);
- }
-
- this.originalBackground = Element.getStyle(this.element, 'background-color');
- if (!this.originalBackground) {
- this.originalBackground = "transparent";
- }
-
- this.element.title = this.options.clickToEditText;
-
- this.onclickListener = this.enterEditMode.bindAsEventListener(this);
- this.mouseoverListener = this.enterHover.bindAsEventListener(this);
- this.mouseoutListener = this.leaveHover.bindAsEventListener(this);
- Event.observe(this.element, 'click', this.onclickListener);
- Event.observe(this.element, 'mouseover', this.mouseoverListener);
- Event.observe(this.element, 'mouseout', this.mouseoutListener);
- if (this.options.externalControl) {
- Event.observe(this.options.externalControl, 'click', this.onclickListener);
- Event.observe(this.options.externalControl, 'mouseover', this.mouseoverListener);
- Event.observe(this.options.externalControl, 'mouseout', this.mouseoutListener);
- }
- },
- enterEditMode: function(evt) {
- if (this.saving) return;
- if (this.editing) return;
- this.editing = true;
- this.onEnterEditMode();
- if (this.options.externalControl) {
- Element.hide(this.options.externalControl);
- }
- Element.hide(this.element);
- this.createForm();
- this.element.parentNode.insertBefore(this.form, this.element);
- if (!this.options.loadTextURL) Field.scrollFreeActivate(this.editField);
- // stop the event to avoid a page refresh in Safari
- if (evt) {
- Event.stop(evt);
- }
- return false;
- },
- createForm: function() {
- this.form = document.createElement("form");
- this.form.id = this.options.formId;
- Element.addClassName(this.form, this.options.formClassName)
- this.form.onsubmit = this.onSubmit.bind(this);
-
- this.createEditField();
-
- if (this.options.textarea) {
- var br = document.createElement("br");
- this.form.appendChild(br);
- }
-
- if (this.options.okButton) {
- okButton = document.createElement("input");
- okButton.type = "submit";
- okButton.value = this.options.okText;
- okButton.className = 'editor_ok_button';
- this.form.appendChild(okButton);
- }
-
- if (this.options.cancelLink) {
- cancelLink = document.createElement("a");
- cancelLink.href = "#";
- cancelLink.appendChild(document.createTextNode(this.options.cancelText));
- cancelLink.onclick = this.onclickCancel.bind(this);
- cancelLink.className = 'editor_cancel';
- this.form.appendChild(cancelLink);
- }
- },
- hasHTMLLineBreaks: function(string) {
- if (!this.options.handleLineBreaks) return false;
- return string.match(/
/i);
- },
- convertHTMLLineBreaks: function(string) {
- return string.replace(/
/gi, "\n").replace(/
/gi, "\n").replace(/<\/p>/gi, "\n").replace(//gi, "");
- },
- createEditField: function() {
- var text;
- if(this.options.loadTextURL) {
- text = this.options.loadingText;
- } else {
- text = this.getText();
- }
-
- var obj = this;
-
- if (this.options.rows == 1 && !this.hasHTMLLineBreaks(text)) {
- this.options.textarea = false;
- var textField = document.createElement("input");
- textField.obj = this;
- textField.type = "text";
- textField.name = this.options.paramName;
- textField.value = text;
- textField.style.backgroundColor = this.options.highlightcolor;
- textField.className = 'editor_field';
- var size = this.options.size || this.options.cols || 0;
- if (size != 0) textField.size = size;
- if (this.options.submitOnBlur)
- textField.onblur = this.onSubmit.bind(this);
- this.editField = textField;
- } else {
- this.options.textarea = true;
- var textArea = document.createElement("textarea");
- textArea.obj = this;
- textArea.name = this.options.paramName;
- textArea.value = this.convertHTMLLineBreaks(text);
- textArea.rows = this.options.rows;
- textArea.cols = this.options.cols || 40;
- textArea.className = 'editor_field';
- if (this.options.submitOnBlur)
- textArea.onblur = this.onSubmit.bind(this);
- this.editField = textArea;
- }
-
- if(this.options.loadTextURL) {
- this.loadExternalText();
- }
- this.form.appendChild(this.editField);
- },
- getText: function() {
- return this.element.innerHTML;
- },
- loadExternalText: function() {
- Element.addClassName(this.form, this.options.loadingClassName);
- this.editField.disabled = true;
- new Ajax.Request(
- this.options.loadTextURL,
- Object.extend({
- asynchronous: true,
- onComplete: this.onLoadedExternalText.bind(this)
- }, this.options.ajaxOptions)
- );
- },
- onLoadedExternalText: function(transport) {
- Element.removeClassName(this.form, this.options.loadingClassName);
- this.editField.disabled = false;
- this.editField.value = transport.responseText.stripTags();
- Field.scrollFreeActivate(this.editField);
- },
- onclickCancel: function() {
- this.onComplete();
- this.leaveEditMode();
- return false;
- },
- onFailure: function(transport) {
- this.options.onFailure(transport);
- if (this.oldInnerHTML) {
- this.element.innerHTML = this.oldInnerHTML;
- this.oldInnerHTML = null;
- }
- return false;
- },
- onSubmit: function() {
- // onLoading resets these so we need to save them away for the Ajax call
- var form = this.form;
- var value = this.editField.value;
-
- // do this first, sometimes the ajax call returns before we get a chance to switch on Saving...
- // which means this will actually switch on Saving... *after* we've left edit mode causing Saving...
- // to be displayed indefinitely
- this.onLoading();
-
- if (this.options.evalScripts) {
- new Ajax.Request(
- this.url, Object.extend({
- parameters: this.options.callback(form, value),
- onComplete: this.onComplete.bind(this),
- onFailure: this.onFailure.bind(this),
- asynchronous:true,
- evalScripts:true
- }, this.options.ajaxOptions));
- } else {
- new Ajax.Updater(
- { success: this.element,
- // don't update on failure (this could be an option)
- failure: null },
- this.url, Object.extend({
- parameters: this.options.callback(form, value),
- onComplete: this.onComplete.bind(this),
- onFailure: this.onFailure.bind(this)
- }, this.options.ajaxOptions));
- }
- // stop the event to avoid a page refresh in Safari
- if (arguments.length > 1) {
- Event.stop(arguments[0]);
- }
- return false;
- },
- onLoading: function() {
- this.saving = true;
- this.removeForm();
- this.leaveHover();
- this.showSaving();
- },
- showSaving: function() {
- this.oldInnerHTML = this.element.innerHTML;
- this.element.innerHTML = this.options.savingText;
- Element.addClassName(this.element, this.options.savingClassName);
- this.element.style.backgroundColor = this.originalBackground;
- Element.show(this.element);
- },
- removeForm: function() {
- if(this.form) {
- if (this.form.parentNode) Element.remove(this.form);
- this.form = null;
- }
- },
- enterHover: function() {
- if (this.saving) return;
- this.element.style.backgroundColor = this.options.highlightcolor;
- if (this.effect) {
- this.effect.cancel();
- }
- Element.addClassName(this.element, this.options.hoverClassName)
- },
- leaveHover: function() {
- if (this.options.backgroundColor) {
- this.element.style.backgroundColor = this.oldBackground;
- }
- Element.removeClassName(this.element, this.options.hoverClassName)
- if (this.saving) return;
- this.effect = new Effect.Highlight(this.element, {
- startcolor: this.options.highlightcolor,
- endcolor: this.options.highlightendcolor,
- restorecolor: this.originalBackground
- });
- },
- leaveEditMode: function() {
- Element.removeClassName(this.element, this.options.savingClassName);
- this.removeForm();
- this.leaveHover();
- this.element.style.backgroundColor = this.originalBackground;
- Element.show(this.element);
- if (this.options.externalControl) {
- Element.show(this.options.externalControl);
- }
- this.editing = false;
- this.saving = false;
- this.oldInnerHTML = null;
- this.onLeaveEditMode();
- },
- onComplete: function(transport) {
- this.leaveEditMode();
- this.options.onComplete.bind(this)(transport, this.element);
- },
- onEnterEditMode: function() {},
- onLeaveEditMode: function() {},
- dispose: function() {
- if (this.oldInnerHTML) {
- this.element.innerHTML = this.oldInnerHTML;
- }
- this.leaveEditMode();
- Event.stopObserving(this.element, 'click', this.onclickListener);
- Event.stopObserving(this.element, 'mouseover', this.mouseoverListener);
- Event.stopObserving(this.element, 'mouseout', this.mouseoutListener);
- if (this.options.externalControl) {
- Event.stopObserving(this.options.externalControl, 'click', this.onclickListener);
- Event.stopObserving(this.options.externalControl, 'mouseover', this.mouseoverListener);
- Event.stopObserving(this.options.externalControl, 'mouseout', this.mouseoutListener);
- }
- }
-};
-
-Ajax.InPlaceCollectionEditor = Class.create();
-Object.extend(Ajax.InPlaceCollectionEditor.prototype, Ajax.InPlaceEditor.prototype);
-Object.extend(Ajax.InPlaceCollectionEditor.prototype, {
- createEditField: function() {
- if (!this.cached_selectTag) {
- var selectTag = document.createElement("select");
- var collection = this.options.collection || [];
- var optionTag;
- collection.each(function(e,i) {
- optionTag = document.createElement("option");
- optionTag.value = (e instanceof Array) ? e[0] : e;
- if((typeof this.options.value == 'undefined') &&
- ((e instanceof Array) ? this.element.innerHTML == e[1] : e == optionTag.value)) optionTag.selected = true;
- if(this.options.value==optionTag.value) optionTag.selected = true;
- optionTag.appendChild(document.createTextNode((e instanceof Array) ? e[1] : e));
- selectTag.appendChild(optionTag);
- }.bind(this));
- this.cached_selectTag = selectTag;
- }
-
- this.editField = this.cached_selectTag;
- if(this.options.loadTextURL) this.loadExternalText();
- this.form.appendChild(this.editField);
- this.options.callback = function(form, value) {
- return "value=" + encodeURIComponent(value);
- }
- }
-});
-
-// Delayed observer, like Form.Element.Observer,
-// but waits for delay after last key input
-// Ideal for live-search fields
-
-Form.Element.DelayedObserver = Class.create();
-Form.Element.DelayedObserver.prototype = {
- initialize: function(element, delay, callback) {
- this.delay = delay || 0.5;
- this.element = $(element);
- this.callback = callback;
- this.timer = null;
- this.lastValue = $F(this.element);
- Event.observe(this.element,'keyup',this.delayedListener.bindAsEventListener(this));
- },
- delayedListener: function(event) {
- if(this.lastValue == $F(this.element)) return;
- if(this.timer) clearTimeout(this.timer);
- this.timer = setTimeout(this.onTimerEvent.bind(this), this.delay * 1000);
- this.lastValue = $F(this.element);
- },
- onTimerEvent: function() {
- this.timer = null;
- this.callback(this.element, $F(this.element));
- }
-};
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/public/javascripts/dragdrop.js b/vendor/gems/has_many_polymorphs-2.13/test/integration/app/public/javascripts/dragdrop.js
deleted file mode 100644
index c71ddb82..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/public/javascripts/dragdrop.js
+++ /dev/null
@@ -1,942 +0,0 @@
-// Copyright (c) 2005, 2006 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
-// (c) 2005, 2006 Sammi Williams (http://www.oriontransfer.co.nz, sammi@oriontransfer.co.nz)
-//
-// script.aculo.us is freely distributable under the terms of an MIT-style license.
-// For details, see the script.aculo.us web site: http://script.aculo.us/
-
-if(typeof Effect == 'undefined')
- throw("dragdrop.js requires including script.aculo.us' effects.js library");
-
-var Droppables = {
- drops: [],
-
- remove: function(element) {
- this.drops = this.drops.reject(function(d) { return d.element==$(element) });
- },
-
- add: function(element) {
- element = $(element);
- var options = Object.extend({
- greedy: true,
- hoverclass: null,
- tree: false
- }, arguments[1] || {});
-
- // cache containers
- if(options.containment) {
- options._containers = [];
- var containment = options.containment;
- if((typeof containment == 'object') &&
- (containment.constructor == Array)) {
- containment.each( function(c) { options._containers.push($(c)) });
- } else {
- options._containers.push($(containment));
- }
- }
-
- if(options.accept) options.accept = [options.accept].flatten();
-
- Element.makePositioned(element); // fix IE
- options.element = element;
-
- this.drops.push(options);
- },
-
- findDeepestChild: function(drops) {
- deepest = drops[0];
-
- for (i = 1; i < drops.length; ++i)
- if (Element.isParent(drops[i].element, deepest.element))
- deepest = drops[i];
-
- return deepest;
- },
-
- isContained: function(element, drop) {
- var containmentNode;
- if(drop.tree) {
- containmentNode = element.treeNode;
- } else {
- containmentNode = element.parentNode;
- }
- return drop._containers.detect(function(c) { return containmentNode == c });
- },
-
- isAffected: function(point, element, drop) {
- return (
- (drop.element!=element) &&
- ((!drop._containers) ||
- this.isContained(element, drop)) &&
- ((!drop.accept) ||
- (Element.classNames(element).detect(
- function(v) { return drop.accept.include(v) } ) )) &&
- Position.within(drop.element, point[0], point[1]) );
- },
-
- deactivate: function(drop) {
- if(drop.hoverclass)
- Element.removeClassName(drop.element, drop.hoverclass);
- this.last_active = null;
- },
-
- activate: function(drop) {
- if(drop.hoverclass)
- Element.addClassName(drop.element, drop.hoverclass);
- this.last_active = drop;
- },
-
- show: function(point, element) {
- if(!this.drops.length) return;
- var affected = [];
-
- if(this.last_active) this.deactivate(this.last_active);
- this.drops.each( function(drop) {
- if(Droppables.isAffected(point, element, drop))
- affected.push(drop);
- });
-
- if(affected.length>0) {
- drop = Droppables.findDeepestChild(affected);
- Position.within(drop.element, point[0], point[1]);
- if(drop.onHover)
- drop.onHover(element, drop.element, Position.overlap(drop.overlap, drop.element));
-
- Droppables.activate(drop);
- }
- },
-
- fire: function(event, element) {
- if(!this.last_active) return;
- Position.prepare();
-
- if (this.isAffected([Event.pointerX(event), Event.pointerY(event)], element, this.last_active))
- if (this.last_active.onDrop)
- this.last_active.onDrop(element, this.last_active.element, event);
- },
-
- reset: function() {
- if(this.last_active)
- this.deactivate(this.last_active);
- }
-}
-
-var Draggables = {
- drags: [],
- observers: [],
-
- register: function(draggable) {
- if(this.drags.length == 0) {
- this.eventMouseUp = this.endDrag.bindAsEventListener(this);
- this.eventMouseMove = this.updateDrag.bindAsEventListener(this);
- this.eventKeypress = this.keyPress.bindAsEventListener(this);
-
- Event.observe(document, "mouseup", this.eventMouseUp);
- Event.observe(document, "mousemove", this.eventMouseMove);
- Event.observe(document, "keypress", this.eventKeypress);
- }
- this.drags.push(draggable);
- },
-
- unregister: function(draggable) {
- this.drags = this.drags.reject(function(d) { return d==draggable });
- if(this.drags.length == 0) {
- Event.stopObserving(document, "mouseup", this.eventMouseUp);
- Event.stopObserving(document, "mousemove", this.eventMouseMove);
- Event.stopObserving(document, "keypress", this.eventKeypress);
- }
- },
-
- activate: function(draggable) {
- if(draggable.options.delay) {
- this._timeout = setTimeout(function() {
- Draggables._timeout = null;
- window.focus();
- Draggables.activeDraggable = draggable;
- }.bind(this), draggable.options.delay);
- } else {
- window.focus(); // allows keypress events if window isn't currently focused, fails for Safari
- this.activeDraggable = draggable;
- }
- },
-
- deactivate: function() {
- this.activeDraggable = null;
- },
-
- updateDrag: function(event) {
- if(!this.activeDraggable) return;
- var pointer = [Event.pointerX(event), Event.pointerY(event)];
- // Mozilla-based browsers fire successive mousemove events with
- // the same coordinates, prevent needless redrawing (moz bug?)
- if(this._lastPointer && (this._lastPointer.inspect() == pointer.inspect())) return;
- this._lastPointer = pointer;
-
- this.activeDraggable.updateDrag(event, pointer);
- },
-
- endDrag: function(event) {
- if(this._timeout) {
- clearTimeout(this._timeout);
- this._timeout = null;
- }
- if(!this.activeDraggable) return;
- this._lastPointer = null;
- this.activeDraggable.endDrag(event);
- this.activeDraggable = null;
- },
-
- keyPress: function(event) {
- if(this.activeDraggable)
- this.activeDraggable.keyPress(event);
- },
-
- addObserver: function(observer) {
- this.observers.push(observer);
- this._cacheObserverCallbacks();
- },
-
- removeObserver: function(element) { // element instead of observer fixes mem leaks
- this.observers = this.observers.reject( function(o) { return o.element==element });
- this._cacheObserverCallbacks();
- },
-
- notify: function(eventName, draggable, event) { // 'onStart', 'onEnd', 'onDrag'
- if(this[eventName+'Count'] > 0)
- this.observers.each( function(o) {
- if(o[eventName]) o[eventName](eventName, draggable, event);
- });
- if(draggable.options[eventName]) draggable.options[eventName](draggable, event);
- },
-
- _cacheObserverCallbacks: function() {
- ['onStart','onEnd','onDrag'].each( function(eventName) {
- Draggables[eventName+'Count'] = Draggables.observers.select(
- function(o) { return o[eventName]; }
- ).length;
- });
- }
-}
-
-/*--------------------------------------------------------------------------*/
-
-var Draggable = Class.create();
-Draggable._dragging = {};
-
-Draggable.prototype = {
- initialize: function(element) {
- var defaults = {
- handle: false,
- reverteffect: function(element, top_offset, left_offset) {
- var dur = Math.sqrt(Math.abs(top_offset^2)+Math.abs(left_offset^2))*0.02;
- new Effect.Move(element, { x: -left_offset, y: -top_offset, duration: dur,
- queue: {scope:'_draggable', position:'end'}
- });
- },
- endeffect: function(element) {
- var toOpacity = typeof element._opacity == 'number' ? element._opacity : 1.0;
- new Effect.Opacity(element, {duration:0.2, from:0.7, to:toOpacity,
- queue: {scope:'_draggable', position:'end'},
- afterFinish: function(){
- Draggable._dragging[element] = false
- }
- });
- },
- zindex: 1000,
- revert: false,
- scroll: false,
- scrollSensitivity: 20,
- scrollSpeed: 15,
- snap: false, // false, or xy or [x,y] or function(x,y){ return [x,y] }
- delay: 0
- };
-
- if(!arguments[1] || typeof arguments[1].endeffect == 'undefined')
- Object.extend(defaults, {
- starteffect: function(element) {
- element._opacity = Element.getOpacity(element);
- Draggable._dragging[element] = true;
- new Effect.Opacity(element, {duration:0.2, from:element._opacity, to:0.7});
- }
- });
-
- var options = Object.extend(defaults, arguments[1] || {});
-
- this.element = $(element);
-
- if(options.handle && (typeof options.handle == 'string'))
- this.handle = this.element.down('.'+options.handle, 0);
-
- if(!this.handle) this.handle = $(options.handle);
- if(!this.handle) this.handle = this.element;
-
- if(options.scroll && !options.scroll.scrollTo && !options.scroll.outerHTML) {
- options.scroll = $(options.scroll);
- this._isScrollChild = Element.childOf(this.element, options.scroll);
- }
-
- Element.makePositioned(this.element); // fix IE
-
- this.delta = this.currentDelta();
- this.options = options;
- this.dragging = false;
-
- this.eventMouseDown = this.initDrag.bindAsEventListener(this);
- Event.observe(this.handle, "mousedown", this.eventMouseDown);
-
- Draggables.register(this);
- },
-
- destroy: function() {
- Event.stopObserving(this.handle, "mousedown", this.eventMouseDown);
- Draggables.unregister(this);
- },
-
- currentDelta: function() {
- return([
- parseInt(Element.getStyle(this.element,'left') || '0'),
- parseInt(Element.getStyle(this.element,'top') || '0')]);
- },
-
- initDrag: function(event) {
- if(typeof Draggable._dragging[this.element] != 'undefined' &&
- Draggable._dragging[this.element]) return;
- if(Event.isLeftClick(event)) {
- // abort on form elements, fixes a Firefox issue
- var src = Event.element(event);
- if(src.tagName && (
- src.tagName=='INPUT' ||
- src.tagName=='SELECT' ||
- src.tagName=='OPTION' ||
- src.tagName=='BUTTON' ||
- src.tagName=='TEXTAREA')) return;
-
- var pointer = [Event.pointerX(event), Event.pointerY(event)];
- var pos = Position.cumulativeOffset(this.element);
- this.offset = [0,1].map( function(i) { return (pointer[i] - pos[i]) });
-
- Draggables.activate(this);
- Event.stop(event);
- }
- },
-
- startDrag: function(event) {
- this.dragging = true;
-
- if(this.options.zindex) {
- this.originalZ = parseInt(Element.getStyle(this.element,'z-index') || 0);
- this.element.style.zIndex = this.options.zindex;
- }
-
- if(this.options.ghosting) {
- this._clone = this.element.cloneNode(true);
- Position.absolutize(this.element);
- this.element.parentNode.insertBefore(this._clone, this.element);
- }
-
- if(this.options.scroll) {
- if (this.options.scroll == window) {
- var where = this._getWindowScroll(this.options.scroll);
- this.originalScrollLeft = where.left;
- this.originalScrollTop = where.top;
- } else {
- this.originalScrollLeft = this.options.scroll.scrollLeft;
- this.originalScrollTop = this.options.scroll.scrollTop;
- }
- }
-
- Draggables.notify('onStart', this, event);
-
- if(this.options.starteffect) this.options.starteffect(this.element);
- },
-
- updateDrag: function(event, pointer) {
- if(!this.dragging) this.startDrag(event);
- Position.prepare();
- Droppables.show(pointer, this.element);
- Draggables.notify('onDrag', this, event);
-
- this.draw(pointer);
- if(this.options.change) this.options.change(this);
-
- if(this.options.scroll) {
- this.stopScrolling();
-
- var p;
- if (this.options.scroll == window) {
- with(this._getWindowScroll(this.options.scroll)) { p = [ left, top, left+width, top+height ]; }
- } else {
- p = Position.page(this.options.scroll);
- p[0] += this.options.scroll.scrollLeft + Position.deltaX;
- p[1] += this.options.scroll.scrollTop + Position.deltaY;
- p.push(p[0]+this.options.scroll.offsetWidth);
- p.push(p[1]+this.options.scroll.offsetHeight);
- }
- var speed = [0,0];
- if(pointer[0] < (p[0]+this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[0]+this.options.scrollSensitivity);
- if(pointer[1] < (p[1]+this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[1]+this.options.scrollSensitivity);
- if(pointer[0] > (p[2]-this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[2]-this.options.scrollSensitivity);
- if(pointer[1] > (p[3]-this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[3]-this.options.scrollSensitivity);
- this.startScrolling(speed);
- }
-
- // fix AppleWebKit rendering
- if(navigator.appVersion.indexOf('AppleWebKit')>0) window.scrollBy(0,0);
-
- Event.stop(event);
- },
-
- finishDrag: function(event, success) {
- this.dragging = false;
-
- if(this.options.ghosting) {
- Position.relativize(this.element);
- Element.remove(this._clone);
- this._clone = null;
- }
-
- if(success) Droppables.fire(event, this.element);
- Draggables.notify('onEnd', this, event);
-
- var revert = this.options.revert;
- if(revert && typeof revert == 'function') revert = revert(this.element);
-
- var d = this.currentDelta();
- if(revert && this.options.reverteffect) {
- this.options.reverteffect(this.element,
- d[1]-this.delta[1], d[0]-this.delta[0]);
- } else {
- this.delta = d;
- }
-
- if(this.options.zindex)
- this.element.style.zIndex = this.originalZ;
-
- if(this.options.endeffect)
- this.options.endeffect(this.element);
-
- Draggables.deactivate(this);
- Droppables.reset();
- },
-
- keyPress: function(event) {
- if(event.keyCode!=Event.KEY_ESC) return;
- this.finishDrag(event, false);
- Event.stop(event);
- },
-
- endDrag: function(event) {
- if(!this.dragging) return;
- this.stopScrolling();
- this.finishDrag(event, true);
- Event.stop(event);
- },
-
- draw: function(point) {
- var pos = Position.cumulativeOffset(this.element);
- if(this.options.ghosting) {
- var r = Position.realOffset(this.element);
- pos[0] += r[0] - Position.deltaX; pos[1] += r[1] - Position.deltaY;
- }
-
- var d = this.currentDelta();
- pos[0] -= d[0]; pos[1] -= d[1];
-
- if(this.options.scroll && (this.options.scroll != window && this._isScrollChild)) {
- pos[0] -= this.options.scroll.scrollLeft-this.originalScrollLeft;
- pos[1] -= this.options.scroll.scrollTop-this.originalScrollTop;
- }
-
- var p = [0,1].map(function(i){
- return (point[i]-pos[i]-this.offset[i])
- }.bind(this));
-
- if(this.options.snap) {
- if(typeof this.options.snap == 'function') {
- p = this.options.snap(p[0],p[1],this);
- } else {
- if(this.options.snap instanceof Array) {
- p = p.map( function(v, i) {
- return Math.round(v/this.options.snap[i])*this.options.snap[i] }.bind(this))
- } else {
- p = p.map( function(v) {
- return Math.round(v/this.options.snap)*this.options.snap }.bind(this))
- }
- }}
-
- var style = this.element.style;
- if((!this.options.constraint) || (this.options.constraint=='horizontal'))
- style.left = p[0] + "px";
- if((!this.options.constraint) || (this.options.constraint=='vertical'))
- style.top = p[1] + "px";
-
- if(style.visibility=="hidden") style.visibility = ""; // fix gecko rendering
- },
-
- stopScrolling: function() {
- if(this.scrollInterval) {
- clearInterval(this.scrollInterval);
- this.scrollInterval = null;
- Draggables._lastScrollPointer = null;
- }
- },
-
- startScrolling: function(speed) {
- if(!(speed[0] || speed[1])) return;
- this.scrollSpeed = [speed[0]*this.options.scrollSpeed,speed[1]*this.options.scrollSpeed];
- this.lastScrolled = new Date();
- this.scrollInterval = setInterval(this.scroll.bind(this), 10);
- },
-
- scroll: function() {
- var current = new Date();
- var delta = current - this.lastScrolled;
- this.lastScrolled = current;
- if(this.options.scroll == window) {
- with (this._getWindowScroll(this.options.scroll)) {
- if (this.scrollSpeed[0] || this.scrollSpeed[1]) {
- var d = delta / 1000;
- this.options.scroll.scrollTo( left + d*this.scrollSpeed[0], top + d*this.scrollSpeed[1] );
- }
- }
- } else {
- this.options.scroll.scrollLeft += this.scrollSpeed[0] * delta / 1000;
- this.options.scroll.scrollTop += this.scrollSpeed[1] * delta / 1000;
- }
-
- Position.prepare();
- Droppables.show(Draggables._lastPointer, this.element);
- Draggables.notify('onDrag', this);
- if (this._isScrollChild) {
- Draggables._lastScrollPointer = Draggables._lastScrollPointer || $A(Draggables._lastPointer);
- Draggables._lastScrollPointer[0] += this.scrollSpeed[0] * delta / 1000;
- Draggables._lastScrollPointer[1] += this.scrollSpeed[1] * delta / 1000;
- if (Draggables._lastScrollPointer[0] < 0)
- Draggables._lastScrollPointer[0] = 0;
- if (Draggables._lastScrollPointer[1] < 0)
- Draggables._lastScrollPointer[1] = 0;
- this.draw(Draggables._lastScrollPointer);
- }
-
- if(this.options.change) this.options.change(this);
- },
-
- _getWindowScroll: function(w) {
- var T, L, W, H;
- with (w.document) {
- if (w.document.documentElement && documentElement.scrollTop) {
- T = documentElement.scrollTop;
- L = documentElement.scrollLeft;
- } else if (w.document.body) {
- T = body.scrollTop;
- L = body.scrollLeft;
- }
- if (w.innerWidth) {
- W = w.innerWidth;
- H = w.innerHeight;
- } else if (w.document.documentElement && documentElement.clientWidth) {
- W = documentElement.clientWidth;
- H = documentElement.clientHeight;
- } else {
- W = body.offsetWidth;
- H = body.offsetHeight
- }
- }
- return { top: T, left: L, width: W, height: H };
- }
-}
-
-/*--------------------------------------------------------------------------*/
-
-var SortableObserver = Class.create();
-SortableObserver.prototype = {
- initialize: function(element, observer) {
- this.element = $(element);
- this.observer = observer;
- this.lastValue = Sortable.serialize(this.element);
- },
-
- onStart: function() {
- this.lastValue = Sortable.serialize(this.element);
- },
-
- onEnd: function() {
- Sortable.unmark();
- if(this.lastValue != Sortable.serialize(this.element))
- this.observer(this.element)
- }
-}
-
-var Sortable = {
- SERIALIZE_RULE: /^[^_\-](?:[A-Za-z0-9\-\_]*)[_](.*)$/,
-
- sortables: {},
-
- _findRootElement: function(element) {
- while (element.tagName != "BODY") {
- if(element.id && Sortable.sortables[element.id]) return element;
- element = element.parentNode;
- }
- },
-
- options: function(element) {
- element = Sortable._findRootElement($(element));
- if(!element) return;
- return Sortable.sortables[element.id];
- },
-
- destroy: function(element){
- var s = Sortable.options(element);
-
- if(s) {
- Draggables.removeObserver(s.element);
- s.droppables.each(function(d){ Droppables.remove(d) });
- s.draggables.invoke('destroy');
-
- delete Sortable.sortables[s.element.id];
- }
- },
-
- create: function(element) {
- element = $(element);
- var options = Object.extend({
- element: element,
- tag: 'li', // assumes li children, override with tag: 'tagname'
- dropOnEmpty: false,
- tree: false,
- treeTag: 'ul',
- overlap: 'vertical', // one of 'vertical', 'horizontal'
- constraint: 'vertical', // one of 'vertical', 'horizontal', false
- containment: element, // also takes array of elements (or id's); or false
- handle: false, // or a CSS class
- only: false,
- delay: 0,
- hoverclass: null,
- ghosting: false,
- scroll: false,
- scrollSensitivity: 20,
- scrollSpeed: 15,
- format: this.SERIALIZE_RULE,
- onChange: Prototype.emptyFunction,
- onUpdate: Prototype.emptyFunction
- }, arguments[1] || {});
-
- // clear any old sortable with same element
- this.destroy(element);
-
- // build options for the draggables
- var options_for_draggable = {
- revert: true,
- scroll: options.scroll,
- scrollSpeed: options.scrollSpeed,
- scrollSensitivity: options.scrollSensitivity,
- delay: options.delay,
- ghosting: options.ghosting,
- constraint: options.constraint,
- handle: options.handle };
-
- if(options.starteffect)
- options_for_draggable.starteffect = options.starteffect;
-
- if(options.reverteffect)
- options_for_draggable.reverteffect = options.reverteffect;
- else
- if(options.ghosting) options_for_draggable.reverteffect = function(element) {
- element.style.top = 0;
- element.style.left = 0;
- };
-
- if(options.endeffect)
- options_for_draggable.endeffect = options.endeffect;
-
- if(options.zindex)
- options_for_draggable.zindex = options.zindex;
-
- // build options for the droppables
- var options_for_droppable = {
- overlap: options.overlap,
- containment: options.containment,
- tree: options.tree,
- hoverclass: options.hoverclass,
- onHover: Sortable.onHover
- }
-
- var options_for_tree = {
- onHover: Sortable.onEmptyHover,
- overlap: options.overlap,
- containment: options.containment,
- hoverclass: options.hoverclass
- }
-
- // fix for gecko engine
- Element.cleanWhitespace(element);
-
- options.draggables = [];
- options.droppables = [];
-
- // drop on empty handling
- if(options.dropOnEmpty || options.tree) {
- Droppables.add(element, options_for_tree);
- options.droppables.push(element);
- }
-
- (this.findElements(element, options) || []).each( function(e) {
- // handles are per-draggable
- var handle = options.handle ?
- $(e).down('.'+options.handle,0) : e;
- options.draggables.push(
- new Draggable(e, Object.extend(options_for_draggable, { handle: handle })));
- Droppables.add(e, options_for_droppable);
- if(options.tree) e.treeNode = element;
- options.droppables.push(e);
- });
-
- if(options.tree) {
- (Sortable.findTreeElements(element, options) || []).each( function(e) {
- Droppables.add(e, options_for_tree);
- e.treeNode = element;
- options.droppables.push(e);
- });
- }
-
- // keep reference
- this.sortables[element.id] = options;
-
- // for onupdate
- Draggables.addObserver(new SortableObserver(element, options.onUpdate));
-
- },
-
- // return all suitable-for-sortable elements in a guaranteed order
- findElements: function(element, options) {
- return Element.findChildren(
- element, options.only, options.tree ? true : false, options.tag);
- },
-
- findTreeElements: function(element, options) {
- return Element.findChildren(
- element, options.only, options.tree ? true : false, options.treeTag);
- },
-
- onHover: function(element, dropon, overlap) {
- if(Element.isParent(dropon, element)) return;
-
- if(overlap > .33 && overlap < .66 && Sortable.options(dropon).tree) {
- return;
- } else if(overlap>0.5) {
- Sortable.mark(dropon, 'before');
- if(dropon.previousSibling != element) {
- var oldParentNode = element.parentNode;
- element.style.visibility = "hidden"; // fix gecko rendering
- dropon.parentNode.insertBefore(element, dropon);
- if(dropon.parentNode!=oldParentNode)
- Sortable.options(oldParentNode).onChange(element);
- Sortable.options(dropon.parentNode).onChange(element);
- }
- } else {
- Sortable.mark(dropon, 'after');
- var nextElement = dropon.nextSibling || null;
- if(nextElement != element) {
- var oldParentNode = element.parentNode;
- element.style.visibility = "hidden"; // fix gecko rendering
- dropon.parentNode.insertBefore(element, nextElement);
- if(dropon.parentNode!=oldParentNode)
- Sortable.options(oldParentNode).onChange(element);
- Sortable.options(dropon.parentNode).onChange(element);
- }
- }
- },
-
- onEmptyHover: function(element, dropon, overlap) {
- var oldParentNode = element.parentNode;
- var droponOptions = Sortable.options(dropon);
-
- if(!Element.isParent(dropon, element)) {
- var index;
-
- var children = Sortable.findElements(dropon, {tag: droponOptions.tag, only: droponOptions.only});
- var child = null;
-
- if(children) {
- var offset = Element.offsetSize(dropon, droponOptions.overlap) * (1.0 - overlap);
-
- for (index = 0; index < children.length; index += 1) {
- if (offset - Element.offsetSize (children[index], droponOptions.overlap) >= 0) {
- offset -= Element.offsetSize (children[index], droponOptions.overlap);
- } else if (offset - (Element.offsetSize (children[index], droponOptions.overlap) / 2) >= 0) {
- child = index + 1 < children.length ? children[index + 1] : null;
- break;
- } else {
- child = children[index];
- break;
- }
- }
- }
-
- dropon.insertBefore(element, child);
-
- Sortable.options(oldParentNode).onChange(element);
- droponOptions.onChange(element);
- }
- },
-
- unmark: function() {
- if(Sortable._marker) Sortable._marker.hide();
- },
-
- mark: function(dropon, position) {
- // mark on ghosting only
- var sortable = Sortable.options(dropon.parentNode);
- if(sortable && !sortable.ghosting) return;
-
- if(!Sortable._marker) {
- Sortable._marker =
- ($('dropmarker') || Element.extend(document.createElement('DIV'))).
- hide().addClassName('dropmarker').setStyle({position:'absolute'});
- document.getElementsByTagName("body").item(0).appendChild(Sortable._marker);
- }
- var offsets = Position.cumulativeOffset(dropon);
- Sortable._marker.setStyle({left: offsets[0]+'px', top: offsets[1] + 'px'});
-
- if(position=='after')
- if(sortable.overlap == 'horizontal')
- Sortable._marker.setStyle({left: (offsets[0]+dropon.clientWidth) + 'px'});
- else
- Sortable._marker.setStyle({top: (offsets[1]+dropon.clientHeight) + 'px'});
-
- Sortable._marker.show();
- },
-
- _tree: function(element, options, parent) {
- var children = Sortable.findElements(element, options) || [];
-
- for (var i = 0; i < children.length; ++i) {
- var match = children[i].id.match(options.format);
-
- if (!match) continue;
-
- var child = {
- id: encodeURIComponent(match ? match[1] : null),
- element: element,
- parent: parent,
- children: [],
- position: parent.children.length,
- container: $(children[i]).down(options.treeTag)
- }
-
- /* Get the element containing the children and recurse over it */
- if (child.container)
- this._tree(child.container, options, child)
-
- parent.children.push (child);
- }
-
- return parent;
- },
-
- tree: function(element) {
- element = $(element);
- var sortableOptions = this.options(element);
- var options = Object.extend({
- tag: sortableOptions.tag,
- treeTag: sortableOptions.treeTag,
- only: sortableOptions.only,
- name: element.id,
- format: sortableOptions.format
- }, arguments[1] || {});
-
- var root = {
- id: null,
- parent: null,
- children: [],
- container: element,
- position: 0
- }
-
- return Sortable._tree(element, options, root);
- },
-
- /* Construct a [i] index for a particular node */
- _constructIndex: function(node) {
- var index = '';
- do {
- if (node.id) index = '[' + node.position + ']' + index;
- } while ((node = node.parent) != null);
- return index;
- },
-
- sequence: function(element) {
- element = $(element);
- var options = Object.extend(this.options(element), arguments[1] || {});
-
- return $(this.findElements(element, options) || []).map( function(item) {
- return item.id.match(options.format) ? item.id.match(options.format)[1] : '';
- });
- },
-
- setSequence: function(element, new_sequence) {
- element = $(element);
- var options = Object.extend(this.options(element), arguments[2] || {});
-
- var nodeMap = {};
- this.findElements(element, options).each( function(n) {
- if (n.id.match(options.format))
- nodeMap[n.id.match(options.format)[1]] = [n, n.parentNode];
- n.parentNode.removeChild(n);
- });
-
- new_sequence.each(function(ident) {
- var n = nodeMap[ident];
- if (n) {
- n[1].appendChild(n[0]);
- delete nodeMap[ident];
- }
- });
- },
-
- serialize: function(element) {
- element = $(element);
- var options = Object.extend(Sortable.options(element), arguments[1] || {});
- var name = encodeURIComponent(
- (arguments[1] && arguments[1].name) ? arguments[1].name : element.id);
-
- if (options.tree) {
- return Sortable.tree(element, arguments[1]).children.map( function (item) {
- return [name + Sortable._constructIndex(item) + "[id]=" +
- encodeURIComponent(item.id)].concat(item.children.map(arguments.callee));
- }).flatten().join('&');
- } else {
- return Sortable.sequence(element, arguments[1]).map( function(item) {
- return name + "[]=" + encodeURIComponent(item);
- }).join('&');
- }
- }
-}
-
-// Returns true if child is contained within element
-Element.isParent = function(child, element) {
- if (!child.parentNode || child == element) return false;
- if (child.parentNode == element) return true;
- return Element.isParent(child.parentNode, element);
-}
-
-Element.findChildren = function(element, only, recursive, tagName) {
- if(!element.hasChildNodes()) return null;
- tagName = tagName.toUpperCase();
- if(only) only = [only].flatten();
- var elements = [];
- $A(element.childNodes).each( function(e) {
- if(e.tagName && e.tagName.toUpperCase()==tagName &&
- (!only || (Element.classNames(e).detect(function(v) { return only.include(v) }))))
- elements.push(e);
- if(recursive) {
- var grandchildren = Element.findChildren(e, only, recursive, tagName);
- if(grandchildren) elements.push(grandchildren);
- }
- });
-
- return (elements.length>0 ? elements.flatten() : []);
-}
-
-Element.offsetSize = function (element, type) {
- return element['offset' + ((type=='vertical' || type=='height') ? 'Height' : 'Width')];
-}
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/public/javascripts/effects.js b/vendor/gems/has_many_polymorphs-2.13/test/integration/app/public/javascripts/effects.js
deleted file mode 100644
index 3b02eda2..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/public/javascripts/effects.js
+++ /dev/null
@@ -1,1088 +0,0 @@
-// Copyright (c) 2005, 2006 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
-// Contributors:
-// Justin Palmer (http://encytemedia.com/)
-// Mark Pilgrim (http://diveintomark.org/)
-// Martin Bialasinki
-//
-// script.aculo.us is freely distributable under the terms of an MIT-style license.
-// For details, see the script.aculo.us web site: http://script.aculo.us/
-
-// converts rgb() and #xxx to #xxxxxx format,
-// returns self (or first argument) if not convertable
-String.prototype.parseColor = function() {
- var color = '#';
- if(this.slice(0,4) == 'rgb(') {
- var cols = this.slice(4,this.length-1).split(',');
- var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3);
- } else {
- if(this.slice(0,1) == '#') {
- if(this.length==4) for(var i=1;i<4;i++) color += (this.charAt(i) + this.charAt(i)).toLowerCase();
- if(this.length==7) color = this.toLowerCase();
- }
- }
- return(color.length==7 ? color : (arguments[0] || this));
-}
-
-/*--------------------------------------------------------------------------*/
-
-Element.collectTextNodes = function(element) {
- return $A($(element).childNodes).collect( function(node) {
- return (node.nodeType==3 ? node.nodeValue :
- (node.hasChildNodes() ? Element.collectTextNodes(node) : ''));
- }).flatten().join('');
-}
-
-Element.collectTextNodesIgnoreClass = function(element, className) {
- return $A($(element).childNodes).collect( function(node) {
- return (node.nodeType==3 ? node.nodeValue :
- ((node.hasChildNodes() && !Element.hasClassName(node,className)) ?
- Element.collectTextNodesIgnoreClass(node, className) : ''));
- }).flatten().join('');
-}
-
-Element.setContentZoom = function(element, percent) {
- element = $(element);
- element.setStyle({fontSize: (percent/100) + 'em'});
- if(navigator.appVersion.indexOf('AppleWebKit')>0) window.scrollBy(0,0);
- return element;
-}
-
-Element.getOpacity = function(element){
- element = $(element);
- var opacity;
- if (opacity = element.getStyle('opacity'))
- return parseFloat(opacity);
- if (opacity = (element.getStyle('filter') || '').match(/alpha\(opacity=(.*)\)/))
- if(opacity[1]) return parseFloat(opacity[1]) / 100;
- return 1.0;
-}
-
-Element.setOpacity = function(element, value){
- element= $(element);
- if (value == 1){
- element.setStyle({ opacity:
- (/Gecko/.test(navigator.userAgent) && !/Konqueror|Safari|KHTML/.test(navigator.userAgent)) ?
- 0.999999 : 1.0 });
- if(/MSIE/.test(navigator.userAgent) && !window.opera)
- element.setStyle({filter: Element.getStyle(element,'filter').replace(/alpha\([^\)]*\)/gi,'')});
- } else {
- if(value < 0.00001) value = 0;
- element.setStyle({opacity: value});
- if(/MSIE/.test(navigator.userAgent) && !window.opera)
- element.setStyle(
- { filter: element.getStyle('filter').replace(/alpha\([^\)]*\)/gi,'') +
- 'alpha(opacity='+value*100+')' });
- }
- return element;
-}
-
-Element.getInlineOpacity = function(element){
- return $(element).style.opacity || '';
-}
-
-Element.forceRerendering = function(element) {
- try {
- element = $(element);
- var n = document.createTextNode(' ');
- element.appendChild(n);
- element.removeChild(n);
- } catch(e) { }
-};
-
-/*--------------------------------------------------------------------------*/
-
-Array.prototype.call = function() {
- var args = arguments;
- this.each(function(f){ f.apply(this, args) });
-}
-
-/*--------------------------------------------------------------------------*/
-
-var Effect = {
- _elementDoesNotExistError: {
- name: 'ElementDoesNotExistError',
- message: 'The specified DOM element does not exist, but is required for this effect to operate'
- },
- tagifyText: function(element) {
- if(typeof Builder == 'undefined')
- throw("Effect.tagifyText requires including script.aculo.us' builder.js library");
-
- var tagifyStyle = 'position:relative';
- if(/MSIE/.test(navigator.userAgent) && !window.opera) tagifyStyle += ';zoom:1';
-
- element = $(element);
- $A(element.childNodes).each( function(child) {
- if(child.nodeType==3) {
- child.nodeValue.toArray().each( function(character) {
- element.insertBefore(
- Builder.node('span',{style: tagifyStyle},
- character == ' ' ? String.fromCharCode(160) : character),
- child);
- });
- Element.remove(child);
- }
- });
- },
- multiple: function(element, effect) {
- var elements;
- if(((typeof element == 'object') ||
- (typeof element == 'function')) &&
- (element.length))
- elements = element;
- else
- elements = $(element).childNodes;
-
- var options = Object.extend({
- speed: 0.1,
- delay: 0.0
- }, arguments[2] || {});
- var masterDelay = options.delay;
-
- $A(elements).each( function(element, index) {
- new effect(element, Object.extend(options, { delay: index * options.speed + masterDelay }));
- });
- },
- PAIRS: {
- 'slide': ['SlideDown','SlideUp'],
- 'blind': ['BlindDown','BlindUp'],
- 'appear': ['Appear','Fade']
- },
- toggle: function(element, effect) {
- element = $(element);
- effect = (effect || 'appear').toLowerCase();
- var options = Object.extend({
- queue: { position:'end', scope:(element.id || 'global'), limit: 1 }
- }, arguments[2] || {});
- Effect[element.visible() ?
- Effect.PAIRS[effect][1] : Effect.PAIRS[effect][0]](element, options);
- }
-};
-
-var Effect2 = Effect; // deprecated
-
-/* ------------- transitions ------------- */
-
-Effect.Transitions = {
- linear: Prototype.K,
- sinoidal: function(pos) {
- return (-Math.cos(pos*Math.PI)/2) + 0.5;
- },
- reverse: function(pos) {
- return 1-pos;
- },
- flicker: function(pos) {
- return ((-Math.cos(pos*Math.PI)/4) + 0.75) + Math.random()/4;
- },
- wobble: function(pos) {
- return (-Math.cos(pos*Math.PI*(9*pos))/2) + 0.5;
- },
- pulse: function(pos, pulses) {
- pulses = pulses || 5;
- return (
- Math.round((pos % (1/pulses)) * pulses) == 0 ?
- ((pos * pulses * 2) - Math.floor(pos * pulses * 2)) :
- 1 - ((pos * pulses * 2) - Math.floor(pos * pulses * 2))
- );
- },
- none: function(pos) {
- return 0;
- },
- full: function(pos) {
- return 1;
- }
-};
-
-/* ------------- core effects ------------- */
-
-Effect.ScopedQueue = Class.create();
-Object.extend(Object.extend(Effect.ScopedQueue.prototype, Enumerable), {
- initialize: function() {
- this.effects = [];
- this.interval = null;
- },
- _each: function(iterator) {
- this.effects._each(iterator);
- },
- add: function(effect) {
- var timestamp = new Date().getTime();
-
- var position = (typeof effect.options.queue == 'string') ?
- effect.options.queue : effect.options.queue.position;
-
- switch(position) {
- case 'front':
- // move unstarted effects after this effect
- this.effects.findAll(function(e){ return e.state=='idle' }).each( function(e) {
- e.startOn += effect.finishOn;
- e.finishOn += effect.finishOn;
- });
- break;
- case 'with-last':
- timestamp = this.effects.pluck('startOn').max() || timestamp;
- break;
- case 'end':
- // start effect after last queued effect has finished
- timestamp = this.effects.pluck('finishOn').max() || timestamp;
- break;
- }
-
- effect.startOn += timestamp;
- effect.finishOn += timestamp;
-
- if(!effect.options.queue.limit || (this.effects.length < effect.options.queue.limit))
- this.effects.push(effect);
-
- if(!this.interval)
- this.interval = setInterval(this.loop.bind(this), 40);
- },
- remove: function(effect) {
- this.effects = this.effects.reject(function(e) { return e==effect });
- if(this.effects.length == 0) {
- clearInterval(this.interval);
- this.interval = null;
- }
- },
- loop: function() {
- var timePos = new Date().getTime();
- this.effects.invoke('loop', timePos);
- }
-});
-
-Effect.Queues = {
- instances: $H(),
- get: function(queueName) {
- if(typeof queueName != 'string') return queueName;
-
- if(!this.instances[queueName])
- this.instances[queueName] = new Effect.ScopedQueue();
-
- return this.instances[queueName];
- }
-}
-Effect.Queue = Effect.Queues.get('global');
-
-Effect.DefaultOptions = {
- transition: Effect.Transitions.sinoidal,
- duration: 1.0, // seconds
- fps: 25.0, // max. 25fps due to Effect.Queue implementation
- sync: false, // true for combining
- from: 0.0,
- to: 1.0,
- delay: 0.0,
- queue: 'parallel'
-}
-
-Effect.Base = function() {};
-Effect.Base.prototype = {
- position: null,
- start: function(options) {
- this.options = Object.extend(Object.extend({},Effect.DefaultOptions), options || {});
- this.currentFrame = 0;
- this.state = 'idle';
- this.startOn = this.options.delay*1000;
- this.finishOn = this.startOn + (this.options.duration*1000);
- this.event('beforeStart');
- if(!this.options.sync)
- Effect.Queues.get(typeof this.options.queue == 'string' ?
- 'global' : this.options.queue.scope).add(this);
- },
- loop: function(timePos) {
- if(timePos >= this.startOn) {
- if(timePos >= this.finishOn) {
- this.render(1.0);
- this.cancel();
- this.event('beforeFinish');
- if(this.finish) this.finish();
- this.event('afterFinish');
- return;
- }
- var pos = (timePos - this.startOn) / (this.finishOn - this.startOn);
- var frame = Math.round(pos * this.options.fps * this.options.duration);
- if(frame > this.currentFrame) {
- this.render(pos);
- this.currentFrame = frame;
- }
- }
- },
- render: function(pos) {
- if(this.state == 'idle') {
- this.state = 'running';
- this.event('beforeSetup');
- if(this.setup) this.setup();
- this.event('afterSetup');
- }
- if(this.state == 'running') {
- if(this.options.transition) pos = this.options.transition(pos);
- pos *= (this.options.to-this.options.from);
- pos += this.options.from;
- this.position = pos;
- this.event('beforeUpdate');
- if(this.update) this.update(pos);
- this.event('afterUpdate');
- }
- },
- cancel: function() {
- if(!this.options.sync)
- Effect.Queues.get(typeof this.options.queue == 'string' ?
- 'global' : this.options.queue.scope).remove(this);
- this.state = 'finished';
- },
- event: function(eventName) {
- if(this.options[eventName + 'Internal']) this.options[eventName + 'Internal'](this);
- if(this.options[eventName]) this.options[eventName](this);
- },
- inspect: function() {
- return '#';
- }
-}
-
-Effect.Parallel = Class.create();
-Object.extend(Object.extend(Effect.Parallel.prototype, Effect.Base.prototype), {
- initialize: function(effects) {
- this.effects = effects || [];
- this.start(arguments[1]);
- },
- update: function(position) {
- this.effects.invoke('render', position);
- },
- finish: function(position) {
- this.effects.each( function(effect) {
- effect.render(1.0);
- effect.cancel();
- effect.event('beforeFinish');
- if(effect.finish) effect.finish(position);
- effect.event('afterFinish');
- });
- }
-});
-
-Effect.Event = Class.create();
-Object.extend(Object.extend(Effect.Event.prototype, Effect.Base.prototype), {
- initialize: function() {
- var options = Object.extend({
- duration: 0
- }, arguments[0] || {});
- this.start(options);
- },
- update: Prototype.emptyFunction
-});
-
-Effect.Opacity = Class.create();
-Object.extend(Object.extend(Effect.Opacity.prototype, Effect.Base.prototype), {
- initialize: function(element) {
- this.element = $(element);
- if(!this.element) throw(Effect._elementDoesNotExistError);
- // make this work on IE on elements without 'layout'
- if(/MSIE/.test(navigator.userAgent) && !window.opera && (!this.element.currentStyle.hasLayout))
- this.element.setStyle({zoom: 1});
- var options = Object.extend({
- from: this.element.getOpacity() || 0.0,
- to: 1.0
- }, arguments[1] || {});
- this.start(options);
- },
- update: function(position) {
- this.element.setOpacity(position);
- }
-});
-
-Effect.Move = Class.create();
-Object.extend(Object.extend(Effect.Move.prototype, Effect.Base.prototype), {
- initialize: function(element) {
- this.element = $(element);
- if(!this.element) throw(Effect._elementDoesNotExistError);
- var options = Object.extend({
- x: 0,
- y: 0,
- mode: 'relative'
- }, arguments[1] || {});
- this.start(options);
- },
- setup: function() {
- // Bug in Opera: Opera returns the "real" position of a static element or
- // relative element that does not have top/left explicitly set.
- // ==> Always set top and left for position relative elements in your stylesheets
- // (to 0 if you do not need them)
- this.element.makePositioned();
- this.originalLeft = parseFloat(this.element.getStyle('left') || '0');
- this.originalTop = parseFloat(this.element.getStyle('top') || '0');
- if(this.options.mode == 'absolute') {
- // absolute movement, so we need to calc deltaX and deltaY
- this.options.x = this.options.x - this.originalLeft;
- this.options.y = this.options.y - this.originalTop;
- }
- },
- update: function(position) {
- this.element.setStyle({
- left: Math.round(this.options.x * position + this.originalLeft) + 'px',
- top: Math.round(this.options.y * position + this.originalTop) + 'px'
- });
- }
-});
-
-// for backwards compatibility
-Effect.MoveBy = function(element, toTop, toLeft) {
- return new Effect.Move(element,
- Object.extend({ x: toLeft, y: toTop }, arguments[3] || {}));
-};
-
-Effect.Scale = Class.create();
-Object.extend(Object.extend(Effect.Scale.prototype, Effect.Base.prototype), {
- initialize: function(element, percent) {
- this.element = $(element);
- if(!this.element) throw(Effect._elementDoesNotExistError);
- var options = Object.extend({
- scaleX: true,
- scaleY: true,
- scaleContent: true,
- scaleFromCenter: false,
- scaleMode: 'box', // 'box' or 'contents' or {} with provided values
- scaleFrom: 100.0,
- scaleTo: percent
- }, arguments[2] || {});
- this.start(options);
- },
- setup: function() {
- this.restoreAfterFinish = this.options.restoreAfterFinish || false;
- this.elementPositioning = this.element.getStyle('position');
-
- this.originalStyle = {};
- ['top','left','width','height','fontSize'].each( function(k) {
- this.originalStyle[k] = this.element.style[k];
- }.bind(this));
-
- this.originalTop = this.element.offsetTop;
- this.originalLeft = this.element.offsetLeft;
-
- var fontSize = this.element.getStyle('font-size') || '100%';
- ['em','px','%','pt'].each( function(fontSizeType) {
- if(fontSize.indexOf(fontSizeType)>0) {
- this.fontSize = parseFloat(fontSize);
- this.fontSizeType = fontSizeType;
- }
- }.bind(this));
-
- this.factor = (this.options.scaleTo - this.options.scaleFrom)/100;
-
- this.dims = null;
- if(this.options.scaleMode=='box')
- this.dims = [this.element.offsetHeight, this.element.offsetWidth];
- if(/^content/.test(this.options.scaleMode))
- this.dims = [this.element.scrollHeight, this.element.scrollWidth];
- if(!this.dims)
- this.dims = [this.options.scaleMode.originalHeight,
- this.options.scaleMode.originalWidth];
- },
- update: function(position) {
- var currentScale = (this.options.scaleFrom/100.0) + (this.factor * position);
- if(this.options.scaleContent && this.fontSize)
- this.element.setStyle({fontSize: this.fontSize * currentScale + this.fontSizeType });
- this.setDimensions(this.dims[0] * currentScale, this.dims[1] * currentScale);
- },
- finish: function(position) {
- if(this.restoreAfterFinish) this.element.setStyle(this.originalStyle);
- },
- setDimensions: function(height, width) {
- var d = {};
- if(this.options.scaleX) d.width = Math.round(width) + 'px';
- if(this.options.scaleY) d.height = Math.round(height) + 'px';
- if(this.options.scaleFromCenter) {
- var topd = (height - this.dims[0])/2;
- var leftd = (width - this.dims[1])/2;
- if(this.elementPositioning == 'absolute') {
- if(this.options.scaleY) d.top = this.originalTop-topd + 'px';
- if(this.options.scaleX) d.left = this.originalLeft-leftd + 'px';
- } else {
- if(this.options.scaleY) d.top = -topd + 'px';
- if(this.options.scaleX) d.left = -leftd + 'px';
- }
- }
- this.element.setStyle(d);
- }
-});
-
-Effect.Highlight = Class.create();
-Object.extend(Object.extend(Effect.Highlight.prototype, Effect.Base.prototype), {
- initialize: function(element) {
- this.element = $(element);
- if(!this.element) throw(Effect._elementDoesNotExistError);
- var options = Object.extend({ startcolor: '#ffff99' }, arguments[1] || {});
- this.start(options);
- },
- setup: function() {
- // Prevent executing on elements not in the layout flow
- if(this.element.getStyle('display')=='none') { this.cancel(); return; }
- // Disable background image during the effect
- this.oldStyle = {
- backgroundImage: this.element.getStyle('background-image') };
- this.element.setStyle({backgroundImage: 'none'});
- if(!this.options.endcolor)
- this.options.endcolor = this.element.getStyle('background-color').parseColor('#ffffff');
- if(!this.options.restorecolor)
- this.options.restorecolor = this.element.getStyle('background-color');
- // init color calculations
- this._base = $R(0,2).map(function(i){ return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16) }.bind(this));
- this._delta = $R(0,2).map(function(i){ return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i] }.bind(this));
- },
- update: function(position) {
- this.element.setStyle({backgroundColor: $R(0,2).inject('#',function(m,v,i){
- return m+(Math.round(this._base[i]+(this._delta[i]*position)).toColorPart()); }.bind(this)) });
- },
- finish: function() {
- this.element.setStyle(Object.extend(this.oldStyle, {
- backgroundColor: this.options.restorecolor
- }));
- }
-});
-
-Effect.ScrollTo = Class.create();
-Object.extend(Object.extend(Effect.ScrollTo.prototype, Effect.Base.prototype), {
- initialize: function(element) {
- this.element = $(element);
- this.start(arguments[1] || {});
- },
- setup: function() {
- Position.prepare();
- var offsets = Position.cumulativeOffset(this.element);
- if(this.options.offset) offsets[1] += this.options.offset;
- var max = window.innerHeight ?
- window.height - window.innerHeight :
- document.body.scrollHeight -
- (document.documentElement.clientHeight ?
- document.documentElement.clientHeight : document.body.clientHeight);
- this.scrollStart = Position.deltaY;
- this.delta = (offsets[1] > max ? max : offsets[1]) - this.scrollStart;
- },
- update: function(position) {
- Position.prepare();
- window.scrollTo(Position.deltaX,
- this.scrollStart + (position*this.delta));
- }
-});
-
-/* ------------- combination effects ------------- */
-
-Effect.Fade = function(element) {
- element = $(element);
- var oldOpacity = element.getInlineOpacity();
- var options = Object.extend({
- from: element.getOpacity() || 1.0,
- to: 0.0,
- afterFinishInternal: function(effect) {
- if(effect.options.to!=0) return;
- effect.element.hide().setStyle({opacity: oldOpacity});
- }}, arguments[1] || {});
- return new Effect.Opacity(element,options);
-}
-
-Effect.Appear = function(element) {
- element = $(element);
- var options = Object.extend({
- from: (element.getStyle('display') == 'none' ? 0.0 : element.getOpacity() || 0.0),
- to: 1.0,
- // force Safari to render floated elements properly
- afterFinishInternal: function(effect) {
- effect.element.forceRerendering();
- },
- beforeSetup: function(effect) {
- effect.element.setOpacity(effect.options.from).show();
- }}, arguments[1] || {});
- return new Effect.Opacity(element,options);
-}
-
-Effect.Puff = function(element) {
- element = $(element);
- var oldStyle = {
- opacity: element.getInlineOpacity(),
- position: element.getStyle('position'),
- top: element.style.top,
- left: element.style.left,
- width: element.style.width,
- height: element.style.height
- };
- return new Effect.Parallel(
- [ new Effect.Scale(element, 200,
- { sync: true, scaleFromCenter: true, scaleContent: true, restoreAfterFinish: true }),
- new Effect.Opacity(element, { sync: true, to: 0.0 } ) ],
- Object.extend({ duration: 1.0,
- beforeSetupInternal: function(effect) {
- Position.absolutize(effect.effects[0].element)
- },
- afterFinishInternal: function(effect) {
- effect.effects[0].element.hide().setStyle(oldStyle); }
- }, arguments[1] || {})
- );
-}
-
-Effect.BlindUp = function(element) {
- element = $(element);
- element.makeClipping();
- return new Effect.Scale(element, 0,
- Object.extend({ scaleContent: false,
- scaleX: false,
- restoreAfterFinish: true,
- afterFinishInternal: function(effect) {
- effect.element.hide().undoClipping();
- }
- }, arguments[1] || {})
- );
-}
-
-Effect.BlindDown = function(element) {
- element = $(element);
- var elementDimensions = element.getDimensions();
- return new Effect.Scale(element, 100, Object.extend({
- scaleContent: false,
- scaleX: false,
- scaleFrom: 0,
- scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
- restoreAfterFinish: true,
- afterSetup: function(effect) {
- effect.element.makeClipping().setStyle({height: '0px'}).show();
- },
- afterFinishInternal: function(effect) {
- effect.element.undoClipping();
- }
- }, arguments[1] || {}));
-}
-
-Effect.SwitchOff = function(element) {
- element = $(element);
- var oldOpacity = element.getInlineOpacity();
- return new Effect.Appear(element, Object.extend({
- duration: 0.4,
- from: 0,
- transition: Effect.Transitions.flicker,
- afterFinishInternal: function(effect) {
- new Effect.Scale(effect.element, 1, {
- duration: 0.3, scaleFromCenter: true,
- scaleX: false, scaleContent: false, restoreAfterFinish: true,
- beforeSetup: function(effect) {
- effect.element.makePositioned().makeClipping();
- },
- afterFinishInternal: function(effect) {
- effect.element.hide().undoClipping().undoPositioned().setStyle({opacity: oldOpacity});
- }
- })
- }
- }, arguments[1] || {}));
-}
-
-Effect.DropOut = function(element) {
- element = $(element);
- var oldStyle = {
- top: element.getStyle('top'),
- left: element.getStyle('left'),
- opacity: element.getInlineOpacity() };
- return new Effect.Parallel(
- [ new Effect.Move(element, {x: 0, y: 100, sync: true }),
- new Effect.Opacity(element, { sync: true, to: 0.0 }) ],
- Object.extend(
- { duration: 0.5,
- beforeSetup: function(effect) {
- effect.effects[0].element.makePositioned();
- },
- afterFinishInternal: function(effect) {
- effect.effects[0].element.hide().undoPositioned().setStyle(oldStyle);
- }
- }, arguments[1] || {}));
-}
-
-Effect.Shake = function(element) {
- element = $(element);
- var oldStyle = {
- top: element.getStyle('top'),
- left: element.getStyle('left') };
- return new Effect.Move(element,
- { x: 20, y: 0, duration: 0.05, afterFinishInternal: function(effect) {
- new Effect.Move(effect.element,
- { x: -40, y: 0, duration: 0.1, afterFinishInternal: function(effect) {
- new Effect.Move(effect.element,
- { x: 40, y: 0, duration: 0.1, afterFinishInternal: function(effect) {
- new Effect.Move(effect.element,
- { x: -40, y: 0, duration: 0.1, afterFinishInternal: function(effect) {
- new Effect.Move(effect.element,
- { x: 40, y: 0, duration: 0.1, afterFinishInternal: function(effect) {
- new Effect.Move(effect.element,
- { x: -20, y: 0, duration: 0.05, afterFinishInternal: function(effect) {
- effect.element.undoPositioned().setStyle(oldStyle);
- }}) }}) }}) }}) }}) }});
-}
-
-Effect.SlideDown = function(element) {
- element = $(element).cleanWhitespace();
- // SlideDown need to have the content of the element wrapped in a container element with fixed height!
- var oldInnerBottom = element.down().getStyle('bottom');
- var elementDimensions = element.getDimensions();
- return new Effect.Scale(element, 100, Object.extend({
- scaleContent: false,
- scaleX: false,
- scaleFrom: window.opera ? 0 : 1,
- scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
- restoreAfterFinish: true,
- afterSetup: function(effect) {
- effect.element.makePositioned();
- effect.element.down().makePositioned();
- if(window.opera) effect.element.setStyle({top: ''});
- effect.element.makeClipping().setStyle({height: '0px'}).show();
- },
- afterUpdateInternal: function(effect) {
- effect.element.down().setStyle({bottom:
- (effect.dims[0] - effect.element.clientHeight) + 'px' });
- },
- afterFinishInternal: function(effect) {
- effect.element.undoClipping().undoPositioned();
- effect.element.down().undoPositioned().setStyle({bottom: oldInnerBottom}); }
- }, arguments[1] || {})
- );
-}
-
-Effect.SlideUp = function(element) {
- element = $(element).cleanWhitespace();
- var oldInnerBottom = element.down().getStyle('bottom');
- return new Effect.Scale(element, window.opera ? 0 : 1,
- Object.extend({ scaleContent: false,
- scaleX: false,
- scaleMode: 'box',
- scaleFrom: 100,
- restoreAfterFinish: true,
- beforeStartInternal: function(effect) {
- effect.element.makePositioned();
- effect.element.down().makePositioned();
- if(window.opera) effect.element.setStyle({top: ''});
- effect.element.makeClipping().show();
- },
- afterUpdateInternal: function(effect) {
- effect.element.down().setStyle({bottom:
- (effect.dims[0] - effect.element.clientHeight) + 'px' });
- },
- afterFinishInternal: function(effect) {
- effect.element.hide().undoClipping().undoPositioned().setStyle({bottom: oldInnerBottom});
- effect.element.down().undoPositioned();
- }
- }, arguments[1] || {})
- );
-}
-
-// Bug in opera makes the TD containing this element expand for a instance after finish
-Effect.Squish = function(element) {
- return new Effect.Scale(element, window.opera ? 1 : 0, {
- restoreAfterFinish: true,
- beforeSetup: function(effect) {
- effect.element.makeClipping();
- },
- afterFinishInternal: function(effect) {
- effect.element.hide().undoClipping();
- }
- });
-}
-
-Effect.Grow = function(element) {
- element = $(element);
- var options = Object.extend({
- direction: 'center',
- moveTransition: Effect.Transitions.sinoidal,
- scaleTransition: Effect.Transitions.sinoidal,
- opacityTransition: Effect.Transitions.full
- }, arguments[1] || {});
- var oldStyle = {
- top: element.style.top,
- left: element.style.left,
- height: element.style.height,
- width: element.style.width,
- opacity: element.getInlineOpacity() };
-
- var dims = element.getDimensions();
- var initialMoveX, initialMoveY;
- var moveX, moveY;
-
- switch (options.direction) {
- case 'top-left':
- initialMoveX = initialMoveY = moveX = moveY = 0;
- break;
- case 'top-right':
- initialMoveX = dims.width;
- initialMoveY = moveY = 0;
- moveX = -dims.width;
- break;
- case 'bottom-left':
- initialMoveX = moveX = 0;
- initialMoveY = dims.height;
- moveY = -dims.height;
- break;
- case 'bottom-right':
- initialMoveX = dims.width;
- initialMoveY = dims.height;
- moveX = -dims.width;
- moveY = -dims.height;
- break;
- case 'center':
- initialMoveX = dims.width / 2;
- initialMoveY = dims.height / 2;
- moveX = -dims.width / 2;
- moveY = -dims.height / 2;
- break;
- }
-
- return new Effect.Move(element, {
- x: initialMoveX,
- y: initialMoveY,
- duration: 0.01,
- beforeSetup: function(effect) {
- effect.element.hide().makeClipping().makePositioned();
- },
- afterFinishInternal: function(effect) {
- new Effect.Parallel(
- [ new Effect.Opacity(effect.element, { sync: true, to: 1.0, from: 0.0, transition: options.opacityTransition }),
- new Effect.Move(effect.element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }),
- new Effect.Scale(effect.element, 100, {
- scaleMode: { originalHeight: dims.height, originalWidth: dims.width },
- sync: true, scaleFrom: window.opera ? 1 : 0, transition: options.scaleTransition, restoreAfterFinish: true})
- ], Object.extend({
- beforeSetup: function(effect) {
- effect.effects[0].element.setStyle({height: '0px'}).show();
- },
- afterFinishInternal: function(effect) {
- effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle);
- }
- }, options)
- )
- }
- });
-}
-
-Effect.Shrink = function(element) {
- element = $(element);
- var options = Object.extend({
- direction: 'center',
- moveTransition: Effect.Transitions.sinoidal,
- scaleTransition: Effect.Transitions.sinoidal,
- opacityTransition: Effect.Transitions.none
- }, arguments[1] || {});
- var oldStyle = {
- top: element.style.top,
- left: element.style.left,
- height: element.style.height,
- width: element.style.width,
- opacity: element.getInlineOpacity() };
-
- var dims = element.getDimensions();
- var moveX, moveY;
-
- switch (options.direction) {
- case 'top-left':
- moveX = moveY = 0;
- break;
- case 'top-right':
- moveX = dims.width;
- moveY = 0;
- break;
- case 'bottom-left':
- moveX = 0;
- moveY = dims.height;
- break;
- case 'bottom-right':
- moveX = dims.width;
- moveY = dims.height;
- break;
- case 'center':
- moveX = dims.width / 2;
- moveY = dims.height / 2;
- break;
- }
-
- return new Effect.Parallel(
- [ new Effect.Opacity(element, { sync: true, to: 0.0, from: 1.0, transition: options.opacityTransition }),
- new Effect.Scale(element, window.opera ? 1 : 0, { sync: true, transition: options.scaleTransition, restoreAfterFinish: true}),
- new Effect.Move(element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition })
- ], Object.extend({
- beforeStartInternal: function(effect) {
- effect.effects[0].element.makePositioned().makeClipping();
- },
- afterFinishInternal: function(effect) {
- effect.effects[0].element.hide().undoClipping().undoPositioned().setStyle(oldStyle); }
- }, options)
- );
-}
-
-Effect.Pulsate = function(element) {
- element = $(element);
- var options = arguments[1] || {};
- var oldOpacity = element.getInlineOpacity();
- var transition = options.transition || Effect.Transitions.sinoidal;
- var reverser = function(pos){ return transition(1-Effect.Transitions.pulse(pos, options.pulses)) };
- reverser.bind(transition);
- return new Effect.Opacity(element,
- Object.extend(Object.extend({ duration: 2.0, from: 0,
- afterFinishInternal: function(effect) { effect.element.setStyle({opacity: oldOpacity}); }
- }, options), {transition: reverser}));
-}
-
-Effect.Fold = function(element) {
- element = $(element);
- var oldStyle = {
- top: element.style.top,
- left: element.style.left,
- width: element.style.width,
- height: element.style.height };
- element.makeClipping();
- return new Effect.Scale(element, 5, Object.extend({
- scaleContent: false,
- scaleX: false,
- afterFinishInternal: function(effect) {
- new Effect.Scale(element, 1, {
- scaleContent: false,
- scaleY: false,
- afterFinishInternal: function(effect) {
- effect.element.hide().undoClipping().setStyle(oldStyle);
- } });
- }}, arguments[1] || {}));
-};
-
-Effect.Morph = Class.create();
-Object.extend(Object.extend(Effect.Morph.prototype, Effect.Base.prototype), {
- initialize: function(element) {
- this.element = $(element);
- if(!this.element) throw(Effect._elementDoesNotExistError);
- var options = Object.extend({
- style: ''
- }, arguments[1] || {});
- this.start(options);
- },
- setup: function(){
- function parseColor(color){
- if(!color || ['rgba(0, 0, 0, 0)','transparent'].include(color)) color = '#ffffff';
- color = color.parseColor();
- return $R(0,2).map(function(i){
- return parseInt( color.slice(i*2+1,i*2+3), 16 )
- });
- }
- this.transforms = this.options.style.parseStyle().map(function(property){
- var originalValue = this.element.getStyle(property[0]);
- return $H({
- style: property[0],
- originalValue: property[1].unit=='color' ?
- parseColor(originalValue) : parseFloat(originalValue || 0),
- targetValue: property[1].unit=='color' ?
- parseColor(property[1].value) : property[1].value,
- unit: property[1].unit
- });
- }.bind(this)).reject(function(transform){
- return (
- (transform.originalValue == transform.targetValue) ||
- (
- transform.unit != 'color' &&
- (isNaN(transform.originalValue) || isNaN(transform.targetValue))
- )
- )
- });
- },
- update: function(position) {
- var style = $H(), value = null;
- this.transforms.each(function(transform){
- value = transform.unit=='color' ?
- $R(0,2).inject('#',function(m,v,i){
- return m+(Math.round(transform.originalValue[i]+
- (transform.targetValue[i] - transform.originalValue[i])*position)).toColorPart() }) :
- transform.originalValue + Math.round(
- ((transform.targetValue - transform.originalValue) * position) * 1000)/1000 + transform.unit;
- style[transform.style] = value;
- });
- this.element.setStyle(style);
- }
-});
-
-Effect.Transform = Class.create();
-Object.extend(Effect.Transform.prototype, {
- initialize: function(tracks){
- this.tracks = [];
- this.options = arguments[1] || {};
- this.addTracks(tracks);
- },
- addTracks: function(tracks){
- tracks.each(function(track){
- var data = $H(track).values().first();
- this.tracks.push($H({
- ids: $H(track).keys().first(),
- effect: Effect.Morph,
- options: { style: data }
- }));
- }.bind(this));
- return this;
- },
- play: function(){
- return new Effect.Parallel(
- this.tracks.map(function(track){
- var elements = [$(track.ids) || $$(track.ids)].flatten();
- return elements.map(function(e){ return new track.effect(e, Object.extend({ sync:true }, track.options)) });
- }).flatten(),
- this.options
- );
- }
-});
-
-Element.CSS_PROPERTIES = ['azimuth', 'backgroundAttachment', 'backgroundColor', 'backgroundImage',
- 'backgroundPosition', 'backgroundRepeat', 'borderBottomColor', 'borderBottomStyle',
- 'borderBottomWidth', 'borderCollapse', 'borderLeftColor', 'borderLeftStyle', 'borderLeftWidth',
- 'borderRightColor', 'borderRightStyle', 'borderRightWidth', 'borderSpacing', 'borderTopColor',
- 'borderTopStyle', 'borderTopWidth', 'bottom', 'captionSide', 'clear', 'clip', 'color', 'content',
- 'counterIncrement', 'counterReset', 'cssFloat', 'cueAfter', 'cueBefore', 'cursor', 'direction',
- 'display', 'elevation', 'emptyCells', 'fontFamily', 'fontSize', 'fontSizeAdjust', 'fontStretch',
- 'fontStyle', 'fontVariant', 'fontWeight', 'height', 'left', 'letterSpacing', 'lineHeight',
- 'listStyleImage', 'listStylePosition', 'listStyleType', 'marginBottom', 'marginLeft', 'marginRight',
- 'marginTop', 'markerOffset', 'marks', 'maxHeight', 'maxWidth', 'minHeight', 'minWidth', 'opacity',
- 'orphans', 'outlineColor', 'outlineOffset', 'outlineStyle', 'outlineWidth', 'overflowX', 'overflowY',
- 'paddingBottom', 'paddingLeft', 'paddingRight', 'paddingTop', 'page', 'pageBreakAfter', 'pageBreakBefore',
- 'pageBreakInside', 'pauseAfter', 'pauseBefore', 'pitch', 'pitchRange', 'position', 'quotes',
- 'richness', 'right', 'size', 'speakHeader', 'speakNumeral', 'speakPunctuation', 'speechRate', 'stress',
- 'tableLayout', 'textAlign', 'textDecoration', 'textIndent', 'textShadow', 'textTransform', 'top',
- 'unicodeBidi', 'verticalAlign', 'visibility', 'voiceFamily', 'volume', 'whiteSpace', 'widows',
- 'width', 'wordSpacing', 'zIndex'];
-
-Element.CSS_LENGTH = /^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/;
-
-String.prototype.parseStyle = function(){
- var element = Element.extend(document.createElement('div'));
- element.innerHTML = '';
- var style = element.down().style, styleRules = $H();
-
- Element.CSS_PROPERTIES.each(function(property){
- if(style[property]) styleRules[property] = style[property];
- });
-
- var result = $H();
-
- styleRules.each(function(pair){
- var property = pair[0], value = pair[1], unit = null;
-
- if(value.parseColor('#zzzzzz') != '#zzzzzz') {
- value = value.parseColor();
- unit = 'color';
- } else if(Element.CSS_LENGTH.test(value))
- var components = value.match(/^([\+\-]?[0-9\.]+)(.*)$/),
- value = parseFloat(components[1]), unit = (components.length == 3) ? components[2] : null;
-
- result[property.underscore().dasherize()] = $H({ value:value, unit:unit });
- }.bind(this));
-
- return result;
-};
-
-Element.morph = function(element, style) {
- new Effect.Morph(element, Object.extend({ style: style }, arguments[2] || {}));
- return element;
-};
-
-['setOpacity','getOpacity','getInlineOpacity','forceRerendering','setContentZoom',
- 'collectTextNodes','collectTextNodesIgnoreClass','morph'].each(
- function(f) { Element.Methods[f] = Element[f]; }
-);
-
-Element.Methods.visualEffect = function(element, effect, options) {
- s = effect.gsub(/_/, '-').camelize();
- effect_class = s.charAt(0).toUpperCase() + s.substring(1);
- new Effect[effect_class](element, options);
- return $(element);
-};
-
-Element.addMethods();
\ No newline at end of file
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/public/javascripts/prototype.js b/vendor/gems/has_many_polymorphs-2.13/test/integration/app/public/javascripts/prototype.js
deleted file mode 100644
index 50582217..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/public/javascripts/prototype.js
+++ /dev/null
@@ -1,2515 +0,0 @@
-/* Prototype JavaScript framework, version 1.5.0
- * (c) 2005-2007 Sam Stephenson
- *
- * Prototype is freely distributable under the terms of an MIT-style license.
- * For details, see the Prototype web site: http://prototype.conio.net/
- *
-/*--------------------------------------------------------------------------*/
-
-var Prototype = {
- Version: '1.5.0',
- BrowserFeatures: {
- XPath: !!document.evaluate
- },
-
- ScriptFragment: '(?:)((\n|\r|.)*?)(?:<\/script>)',
- emptyFunction: function() {},
- K: function(x) { return x }
-}
-
-var Class = {
- create: function() {
- return function() {
- this.initialize.apply(this, arguments);
- }
- }
-}
-
-var Abstract = new Object();
-
-Object.extend = function(destination, source) {
- for (var property in source) {
- destination[property] = source[property];
- }
- return destination;
-}
-
-Object.extend(Object, {
- inspect: function(object) {
- try {
- if (object === undefined) return 'undefined';
- if (object === null) return 'null';
- return object.inspect ? object.inspect() : object.toString();
- } catch (e) {
- if (e instanceof RangeError) return '...';
- throw e;
- }
- },
-
- keys: function(object) {
- var keys = [];
- for (var property in object)
- keys.push(property);
- return keys;
- },
-
- values: function(object) {
- var values = [];
- for (var property in object)
- values.push(object[property]);
- return values;
- },
-
- clone: function(object) {
- return Object.extend({}, object);
- }
-});
-
-Function.prototype.bind = function() {
- var __method = this, args = $A(arguments), object = args.shift();
- return function() {
- return __method.apply(object, args.concat($A(arguments)));
- }
-}
-
-Function.prototype.bindAsEventListener = function(object) {
- var __method = this, args = $A(arguments), object = args.shift();
- return function(event) {
- return __method.apply(object, [( event || window.event)].concat(args).concat($A(arguments)));
- }
-}
-
-Object.extend(Number.prototype, {
- toColorPart: function() {
- var digits = this.toString(16);
- if (this < 16) return '0' + digits;
- return digits;
- },
-
- succ: function() {
- return this + 1;
- },
-
- times: function(iterator) {
- $R(0, this, true).each(iterator);
- return this;
- }
-});
-
-var Try = {
- these: function() {
- var returnValue;
-
- for (var i = 0, length = arguments.length; i < length; i++) {
- var lambda = arguments[i];
- try {
- returnValue = lambda();
- break;
- } catch (e) {}
- }
-
- return returnValue;
- }
-}
-
-/*--------------------------------------------------------------------------*/
-
-var PeriodicalExecuter = Class.create();
-PeriodicalExecuter.prototype = {
- initialize: function(callback, frequency) {
- this.callback = callback;
- this.frequency = frequency;
- this.currentlyExecuting = false;
-
- this.registerCallback();
- },
-
- registerCallback: function() {
- this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
- },
-
- stop: function() {
- if (!this.timer) return;
- clearInterval(this.timer);
- this.timer = null;
- },
-
- onTimerEvent: function() {
- if (!this.currentlyExecuting) {
- try {
- this.currentlyExecuting = true;
- this.callback(this);
- } finally {
- this.currentlyExecuting = false;
- }
- }
- }
-}
-String.interpret = function(value){
- return value == null ? '' : String(value);
-}
-
-Object.extend(String.prototype, {
- gsub: function(pattern, replacement) {
- var result = '', source = this, match;
- replacement = arguments.callee.prepareReplacement(replacement);
-
- while (source.length > 0) {
- if (match = source.match(pattern)) {
- result += source.slice(0, match.index);
- result += String.interpret(replacement(match));
- source = source.slice(match.index + match[0].length);
- } else {
- result += source, source = '';
- }
- }
- return result;
- },
-
- sub: function(pattern, replacement, count) {
- replacement = this.gsub.prepareReplacement(replacement);
- count = count === undefined ? 1 : count;
-
- return this.gsub(pattern, function(match) {
- if (--count < 0) return match[0];
- return replacement(match);
- });
- },
-
- scan: function(pattern, iterator) {
- this.gsub(pattern, iterator);
- return this;
- },
-
- truncate: function(length, truncation) {
- length = length || 30;
- truncation = truncation === undefined ? '...' : truncation;
- return this.length > length ?
- this.slice(0, length - truncation.length) + truncation : this;
- },
-
- strip: function() {
- return this.replace(/^\s+/, '').replace(/\s+$/, '');
- },
-
- stripTags: function() {
- return this.replace(/<\/?[^>]+>/gi, '');
- },
-
- stripScripts: function() {
- return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), '');
- },
-
- extractScripts: function() {
- var matchAll = new RegExp(Prototype.ScriptFragment, 'img');
- var matchOne = new RegExp(Prototype.ScriptFragment, 'im');
- return (this.match(matchAll) || []).map(function(scriptTag) {
- return (scriptTag.match(matchOne) || ['', ''])[1];
- });
- },
-
- evalScripts: function() {
- return this.extractScripts().map(function(script) { return eval(script) });
- },
-
- escapeHTML: function() {
- var div = document.createElement('div');
- var text = document.createTextNode(this);
- div.appendChild(text);
- return div.innerHTML;
- },
-
- unescapeHTML: function() {
- var div = document.createElement('div');
- div.innerHTML = this.stripTags();
- return div.childNodes[0] ? (div.childNodes.length > 1 ?
- $A(div.childNodes).inject('',function(memo,node){ return memo+node.nodeValue }) :
- div.childNodes[0].nodeValue) : '';
- },
-
- toQueryParams: function(separator) {
- var match = this.strip().match(/([^?#]*)(#.*)?$/);
- if (!match) return {};
-
- return match[1].split(separator || '&').inject({}, function(hash, pair) {
- if ((pair = pair.split('='))[0]) {
- var name = decodeURIComponent(pair[0]);
- var value = pair[1] ? decodeURIComponent(pair[1]) : undefined;
-
- if (hash[name] !== undefined) {
- if (hash[name].constructor != Array)
- hash[name] = [hash[name]];
- if (value) hash[name].push(value);
- }
- else hash[name] = value;
- }
- return hash;
- });
- },
-
- toArray: function() {
- return this.split('');
- },
-
- succ: function() {
- return this.slice(0, this.length - 1) +
- String.fromCharCode(this.charCodeAt(this.length - 1) + 1);
- },
-
- camelize: function() {
- var parts = this.split('-'), len = parts.length;
- if (len == 1) return parts[0];
-
- var camelized = this.charAt(0) == '-'
- ? parts[0].charAt(0).toUpperCase() + parts[0].substring(1)
- : parts[0];
-
- for (var i = 1; i < len; i++)
- camelized += parts[i].charAt(0).toUpperCase() + parts[i].substring(1);
-
- return camelized;
- },
-
- capitalize: function(){
- return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase();
- },
-
- underscore: function() {
- return this.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/,'#{1}_#{2}').gsub(/([a-z\d])([A-Z])/,'#{1}_#{2}').gsub(/-/,'_').toLowerCase();
- },
-
- dasherize: function() {
- return this.gsub(/_/,'-');
- },
-
- inspect: function(useDoubleQuotes) {
- var escapedString = this.replace(/\\/g, '\\\\');
- if (useDoubleQuotes)
- return '"' + escapedString.replace(/"/g, '\\"') + '"';
- else
- return "'" + escapedString.replace(/'/g, '\\\'') + "'";
- }
-});
-
-String.prototype.gsub.prepareReplacement = function(replacement) {
- if (typeof replacement == 'function') return replacement;
- var template = new Template(replacement);
- return function(match) { return template.evaluate(match) };
-}
-
-String.prototype.parseQuery = String.prototype.toQueryParams;
-
-var Template = Class.create();
-Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/;
-Template.prototype = {
- initialize: function(template, pattern) {
- this.template = template.toString();
- this.pattern = pattern || Template.Pattern;
- },
-
- evaluate: function(object) {
- return this.template.gsub(this.pattern, function(match) {
- var before = match[1];
- if (before == '\\') return match[2];
- return before + String.interpret(object[match[3]]);
- });
- }
-}
-
-var $break = new Object();
-var $continue = new Object();
-
-var Enumerable = {
- each: function(iterator) {
- var index = 0;
- try {
- this._each(function(value) {
- try {
- iterator(value, index++);
- } catch (e) {
- if (e != $continue) throw e;
- }
- });
- } catch (e) {
- if (e != $break) throw e;
- }
- return this;
- },
-
- eachSlice: function(number, iterator) {
- var index = -number, slices = [], array = this.toArray();
- while ((index += number) < array.length)
- slices.push(array.slice(index, index+number));
- return slices.map(iterator);
- },
-
- all: function(iterator) {
- var result = true;
- this.each(function(value, index) {
- result = result && !!(iterator || Prototype.K)(value, index);
- if (!result) throw $break;
- });
- return result;
- },
-
- any: function(iterator) {
- var result = false;
- this.each(function(value, index) {
- if (result = !!(iterator || Prototype.K)(value, index))
- throw $break;
- });
- return result;
- },
-
- collect: function(iterator) {
- var results = [];
- this.each(function(value, index) {
- results.push((iterator || Prototype.K)(value, index));
- });
- return results;
- },
-
- detect: function(iterator) {
- var result;
- this.each(function(value, index) {
- if (iterator(value, index)) {
- result = value;
- throw $break;
- }
- });
- return result;
- },
-
- findAll: function(iterator) {
- var results = [];
- this.each(function(value, index) {
- if (iterator(value, index))
- results.push(value);
- });
- return results;
- },
-
- grep: function(pattern, iterator) {
- var results = [];
- this.each(function(value, index) {
- var stringValue = value.toString();
- if (stringValue.match(pattern))
- results.push((iterator || Prototype.K)(value, index));
- })
- return results;
- },
-
- include: function(object) {
- var found = false;
- this.each(function(value) {
- if (value == object) {
- found = true;
- throw $break;
- }
- });
- return found;
- },
-
- inGroupsOf: function(number, fillWith) {
- fillWith = fillWith === undefined ? null : fillWith;
- return this.eachSlice(number, function(slice) {
- while(slice.length < number) slice.push(fillWith);
- return slice;
- });
- },
-
- inject: function(memo, iterator) {
- this.each(function(value, index) {
- memo = iterator(memo, value, index);
- });
- return memo;
- },
-
- invoke: function(method) {
- var args = $A(arguments).slice(1);
- return this.map(function(value) {
- return value[method].apply(value, args);
- });
- },
-
- max: function(iterator) {
- var result;
- this.each(function(value, index) {
- value = (iterator || Prototype.K)(value, index);
- if (result == undefined || value >= result)
- result = value;
- });
- return result;
- },
-
- min: function(iterator) {
- var result;
- this.each(function(value, index) {
- value = (iterator || Prototype.K)(value, index);
- if (result == undefined || value < result)
- result = value;
- });
- return result;
- },
-
- partition: function(iterator) {
- var trues = [], falses = [];
- this.each(function(value, index) {
- ((iterator || Prototype.K)(value, index) ?
- trues : falses).push(value);
- });
- return [trues, falses];
- },
-
- pluck: function(property) {
- var results = [];
- this.each(function(value, index) {
- results.push(value[property]);
- });
- return results;
- },
-
- reject: function(iterator) {
- var results = [];
- this.each(function(value, index) {
- if (!iterator(value, index))
- results.push(value);
- });
- return results;
- },
-
- sortBy: function(iterator) {
- return this.map(function(value, index) {
- return {value: value, criteria: iterator(value, index)};
- }).sort(function(left, right) {
- var a = left.criteria, b = right.criteria;
- return a < b ? -1 : a > b ? 1 : 0;
- }).pluck('value');
- },
-
- toArray: function() {
- return this.map();
- },
-
- zip: function() {
- var iterator = Prototype.K, args = $A(arguments);
- if (typeof args.last() == 'function')
- iterator = args.pop();
-
- var collections = [this].concat(args).map($A);
- return this.map(function(value, index) {
- return iterator(collections.pluck(index));
- });
- },
-
- size: function() {
- return this.toArray().length;
- },
-
- inspect: function() {
- return '#';
- }
-}
-
-Object.extend(Enumerable, {
- map: Enumerable.collect,
- find: Enumerable.detect,
- select: Enumerable.findAll,
- member: Enumerable.include,
- entries: Enumerable.toArray
-});
-var $A = Array.from = function(iterable) {
- if (!iterable) return [];
- if (iterable.toArray) {
- return iterable.toArray();
- } else {
- var results = [];
- for (var i = 0, length = iterable.length; i < length; i++)
- results.push(iterable[i]);
- return results;
- }
-}
-
-Object.extend(Array.prototype, Enumerable);
-
-if (!Array.prototype._reverse)
- Array.prototype._reverse = Array.prototype.reverse;
-
-Object.extend(Array.prototype, {
- _each: function(iterator) {
- for (var i = 0, length = this.length; i < length; i++)
- iterator(this[i]);
- },
-
- clear: function() {
- this.length = 0;
- return this;
- },
-
- first: function() {
- return this[0];
- },
-
- last: function() {
- return this[this.length - 1];
- },
-
- compact: function() {
- return this.select(function(value) {
- return value != null;
- });
- },
-
- flatten: function() {
- return this.inject([], function(array, value) {
- return array.concat(value && value.constructor == Array ?
- value.flatten() : [value]);
- });
- },
-
- without: function() {
- var values = $A(arguments);
- return this.select(function(value) {
- return !values.include(value);
- });
- },
-
- indexOf: function(object) {
- for (var i = 0, length = this.length; i < length; i++)
- if (this[i] == object) return i;
- return -1;
- },
-
- reverse: function(inline) {
- return (inline !== false ? this : this.toArray())._reverse();
- },
-
- reduce: function() {
- return this.length > 1 ? this : this[0];
- },
-
- uniq: function() {
- return this.inject([], function(array, value) {
- return array.include(value) ? array : array.concat([value]);
- });
- },
-
- clone: function() {
- return [].concat(this);
- },
-
- size: function() {
- return this.length;
- },
-
- inspect: function() {
- return '[' + this.map(Object.inspect).join(', ') + ']';
- }
-});
-
-Array.prototype.toArray = Array.prototype.clone;
-
-function $w(string){
- string = string.strip();
- return string ? string.split(/\s+/) : [];
-}
-
-if(window.opera){
- Array.prototype.concat = function(){
- var array = [];
- for(var i = 0, length = this.length; i < length; i++) array.push(this[i]);
- for(var i = 0, length = arguments.length; i < length; i++) {
- if(arguments[i].constructor == Array) {
- for(var j = 0, arrayLength = arguments[i].length; j < arrayLength; j++)
- array.push(arguments[i][j]);
- } else {
- array.push(arguments[i]);
- }
- }
- return array;
- }
-}
-var Hash = function(obj) {
- Object.extend(this, obj || {});
-};
-
-Object.extend(Hash, {
- toQueryString: function(obj) {
- var parts = [];
-
- this.prototype._each.call(obj, function(pair) {
- if (!pair.key) return;
-
- if (pair.value && pair.value.constructor == Array) {
- var values = pair.value.compact();
- if (values.length < 2) pair.value = values.reduce();
- else {
- key = encodeURIComponent(pair.key);
- values.each(function(value) {
- value = value != undefined ? encodeURIComponent(value) : '';
- parts.push(key + '=' + encodeURIComponent(value));
- });
- return;
- }
- }
- if (pair.value == undefined) pair[1] = '';
- parts.push(pair.map(encodeURIComponent).join('='));
- });
-
- return parts.join('&');
- }
-});
-
-Object.extend(Hash.prototype, Enumerable);
-Object.extend(Hash.prototype, {
- _each: function(iterator) {
- for (var key in this) {
- var value = this[key];
- if (value && value == Hash.prototype[key]) continue;
-
- var pair = [key, value];
- pair.key = key;
- pair.value = value;
- iterator(pair);
- }
- },
-
- keys: function() {
- return this.pluck('key');
- },
-
- values: function() {
- return this.pluck('value');
- },
-
- merge: function(hash) {
- return $H(hash).inject(this, function(mergedHash, pair) {
- mergedHash[pair.key] = pair.value;
- return mergedHash;
- });
- },
-
- remove: function() {
- var result;
- for(var i = 0, length = arguments.length; i < length; i++) {
- var value = this[arguments[i]];
- if (value !== undefined){
- if (result === undefined) result = value;
- else {
- if (result.constructor != Array) result = [result];
- result.push(value)
- }
- }
- delete this[arguments[i]];
- }
- return result;
- },
-
- toQueryString: function() {
- return Hash.toQueryString(this);
- },
-
- inspect: function() {
- return '#';
- }
-});
-
-function $H(object) {
- if (object && object.constructor == Hash) return object;
- return new Hash(object);
-};
-ObjectRange = Class.create();
-Object.extend(ObjectRange.prototype, Enumerable);
-Object.extend(ObjectRange.prototype, {
- initialize: function(start, end, exclusive) {
- this.start = start;
- this.end = end;
- this.exclusive = exclusive;
- },
-
- _each: function(iterator) {
- var value = this.start;
- while (this.include(value)) {
- iterator(value);
- value = value.succ();
- }
- },
-
- include: function(value) {
- if (value < this.start)
- return false;
- if (this.exclusive)
- return value < this.end;
- return value <= this.end;
- }
-});
-
-var $R = function(start, end, exclusive) {
- return new ObjectRange(start, end, exclusive);
-}
-
-var Ajax = {
- getTransport: function() {
- return Try.these(
- function() {return new XMLHttpRequest()},
- function() {return new ActiveXObject('Msxml2.XMLHTTP')},
- function() {return new ActiveXObject('Microsoft.XMLHTTP')}
- ) || false;
- },
-
- activeRequestCount: 0
-}
-
-Ajax.Responders = {
- responders: [],
-
- _each: function(iterator) {
- this.responders._each(iterator);
- },
-
- register: function(responder) {
- if (!this.include(responder))
- this.responders.push(responder);
- },
-
- unregister: function(responder) {
- this.responders = this.responders.without(responder);
- },
-
- dispatch: function(callback, request, transport, json) {
- this.each(function(responder) {
- if (typeof responder[callback] == 'function') {
- try {
- responder[callback].apply(responder, [request, transport, json]);
- } catch (e) {}
- }
- });
- }
-};
-
-Object.extend(Ajax.Responders, Enumerable);
-
-Ajax.Responders.register({
- onCreate: function() {
- Ajax.activeRequestCount++;
- },
- onComplete: function() {
- Ajax.activeRequestCount--;
- }
-});
-
-Ajax.Base = function() {};
-Ajax.Base.prototype = {
- setOptions: function(options) {
- this.options = {
- method: 'post',
- asynchronous: true,
- contentType: 'application/x-www-form-urlencoded',
- encoding: 'UTF-8',
- parameters: ''
- }
- Object.extend(this.options, options || {});
-
- this.options.method = this.options.method.toLowerCase();
- if (typeof this.options.parameters == 'string')
- this.options.parameters = this.options.parameters.toQueryParams();
- }
-}
-
-Ajax.Request = Class.create();
-Ajax.Request.Events =
- ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];
-
-Ajax.Request.prototype = Object.extend(new Ajax.Base(), {
- _complete: false,
-
- initialize: function(url, options) {
- this.transport = Ajax.getTransport();
- this.setOptions(options);
- this.request(url);
- },
-
- request: function(url) {
- this.url = url;
- this.method = this.options.method;
- var params = this.options.parameters;
-
- if (!['get', 'post'].include(this.method)) {
- // simulate other verbs over post
- params['_method'] = this.method;
- this.method = 'post';
- }
-
- params = Hash.toQueryString(params);
- if (params && /Konqueror|Safari|KHTML/.test(navigator.userAgent)) params += '&_='
-
- // when GET, append parameters to URL
- if (this.method == 'get' && params)
- this.url += (this.url.indexOf('?') > -1 ? '&' : '?') + params;
-
- try {
- Ajax.Responders.dispatch('onCreate', this, this.transport);
-
- this.transport.open(this.method.toUpperCase(), this.url,
- this.options.asynchronous);
-
- if (this.options.asynchronous)
- setTimeout(function() { this.respondToReadyState(1) }.bind(this), 10);
-
- this.transport.onreadystatechange = this.onStateChange.bind(this);
- this.setRequestHeaders();
-
- var body = this.method == 'post' ? (this.options.postBody || params) : null;
-
- this.transport.send(body);
-
- /* Force Firefox to handle ready state 4 for synchronous requests */
- if (!this.options.asynchronous && this.transport.overrideMimeType)
- this.onStateChange();
-
- }
- catch (e) {
- this.dispatchException(e);
- }
- },
-
- onStateChange: function() {
- var readyState = this.transport.readyState;
- if (readyState > 1 && !((readyState == 4) && this._complete))
- this.respondToReadyState(this.transport.readyState);
- },
-
- setRequestHeaders: function() {
- var headers = {
- 'X-Requested-With': 'XMLHttpRequest',
- 'X-Prototype-Version': Prototype.Version,
- 'Accept': 'text/javascript, text/html, application/xml, text/xml, */*'
- };
-
- if (this.method == 'post') {
- headers['Content-type'] = this.options.contentType +
- (this.options.encoding ? '; charset=' + this.options.encoding : '');
-
- /* Force "Connection: close" for older Mozilla browsers to work
- * around a bug where XMLHttpRequest sends an incorrect
- * Content-length header. See Mozilla Bugzilla #246651.
- */
- if (this.transport.overrideMimeType &&
- (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005)
- headers['Connection'] = 'close';
- }
-
- // user-defined headers
- if (typeof this.options.requestHeaders == 'object') {
- var extras = this.options.requestHeaders;
-
- if (typeof extras.push == 'function')
- for (var i = 0, length = extras.length; i < length; i += 2)
- headers[extras[i]] = extras[i+1];
- else
- $H(extras).each(function(pair) { headers[pair.key] = pair.value });
- }
-
- for (var name in headers)
- this.transport.setRequestHeader(name, headers[name]);
- },
-
- success: function() {
- return !this.transport.status
- || (this.transport.status >= 200 && this.transport.status < 300);
- },
-
- respondToReadyState: function(readyState) {
- var state = Ajax.Request.Events[readyState];
- var transport = this.transport, json = this.evalJSON();
-
- if (state == 'Complete') {
- try {
- this._complete = true;
- (this.options['on' + this.transport.status]
- || this.options['on' + (this.success() ? 'Success' : 'Failure')]
- || Prototype.emptyFunction)(transport, json);
- } catch (e) {
- this.dispatchException(e);
- }
-
- if ((this.getHeader('Content-type') || 'text/javascript').strip().
- match(/^(text|application)\/(x-)?(java|ecma)script(;.*)?$/i))
- this.evalResponse();
- }
-
- try {
- (this.options['on' + state] || Prototype.emptyFunction)(transport, json);
- Ajax.Responders.dispatch('on' + state, this, transport, json);
- } catch (e) {
- this.dispatchException(e);
- }
-
- if (state == 'Complete') {
- // avoid memory leak in MSIE: clean up
- this.transport.onreadystatechange = Prototype.emptyFunction;
- }
- },
-
- getHeader: function(name) {
- try {
- return this.transport.getResponseHeader(name);
- } catch (e) { return null }
- },
-
- evalJSON: function() {
- try {
- var json = this.getHeader('X-JSON');
- return json ? eval('(' + json + ')') : null;
- } catch (e) { return null }
- },
-
- evalResponse: function() {
- try {
- return eval(this.transport.responseText);
- } catch (e) {
- this.dispatchException(e);
- }
- },
-
- dispatchException: function(exception) {
- (this.options.onException || Prototype.emptyFunction)(this, exception);
- Ajax.Responders.dispatch('onException', this, exception);
- }
-});
-
-Ajax.Updater = Class.create();
-
-Object.extend(Object.extend(Ajax.Updater.prototype, Ajax.Request.prototype), {
- initialize: function(container, url, options) {
- this.container = {
- success: (container.success || container),
- failure: (container.failure || (container.success ? null : container))
- }
-
- this.transport = Ajax.getTransport();
- this.setOptions(options);
-
- var onComplete = this.options.onComplete || Prototype.emptyFunction;
- this.options.onComplete = (function(transport, param) {
- this.updateContent();
- onComplete(transport, param);
- }).bind(this);
-
- this.request(url);
- },
-
- updateContent: function() {
- var receiver = this.container[this.success() ? 'success' : 'failure'];
- var response = this.transport.responseText;
-
- if (!this.options.evalScripts) response = response.stripScripts();
-
- if (receiver = $(receiver)) {
- if (this.options.insertion)
- new this.options.insertion(receiver, response);
- else
- receiver.update(response);
- }
-
- if (this.success()) {
- if (this.onComplete)
- setTimeout(this.onComplete.bind(this), 10);
- }
- }
-});
-
-Ajax.PeriodicalUpdater = Class.create();
-Ajax.PeriodicalUpdater.prototype = Object.extend(new Ajax.Base(), {
- initialize: function(container, url, options) {
- this.setOptions(options);
- this.onComplete = this.options.onComplete;
-
- this.frequency = (this.options.frequency || 2);
- this.decay = (this.options.decay || 1);
-
- this.updater = {};
- this.container = container;
- this.url = url;
-
- this.start();
- },
-
- start: function() {
- this.options.onComplete = this.updateComplete.bind(this);
- this.onTimerEvent();
- },
-
- stop: function() {
- this.updater.options.onComplete = undefined;
- clearTimeout(this.timer);
- (this.onComplete || Prototype.emptyFunction).apply(this, arguments);
- },
-
- updateComplete: function(request) {
- if (this.options.decay) {
- this.decay = (request.responseText == this.lastText ?
- this.decay * this.options.decay : 1);
-
- this.lastText = request.responseText;
- }
- this.timer = setTimeout(this.onTimerEvent.bind(this),
- this.decay * this.frequency * 1000);
- },
-
- onTimerEvent: function() {
- this.updater = new Ajax.Updater(this.container, this.url, this.options);
- }
-});
-function $(element) {
- if (arguments.length > 1) {
- for (var i = 0, elements = [], length = arguments.length; i < length; i++)
- elements.push($(arguments[i]));
- return elements;
- }
- if (typeof element == 'string')
- element = document.getElementById(element);
- return Element.extend(element);
-}
-
-if (Prototype.BrowserFeatures.XPath) {
- document._getElementsByXPath = function(expression, parentElement) {
- var results = [];
- var query = document.evaluate(expression, $(parentElement) || document,
- null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
- for (var i = 0, length = query.snapshotLength; i < length; i++)
- results.push(query.snapshotItem(i));
- return results;
- };
-}
-
-document.getElementsByClassName = function(className, parentElement) {
- if (Prototype.BrowserFeatures.XPath) {
- var q = ".//*[contains(concat(' ', @class, ' '), ' " + className + " ')]";
- return document._getElementsByXPath(q, parentElement);
- } else {
- var children = ($(parentElement) || document.body).getElementsByTagName('*');
- var elements = [], child;
- for (var i = 0, length = children.length; i < length; i++) {
- child = children[i];
- if (Element.hasClassName(child, className))
- elements.push(Element.extend(child));
- }
- return elements;
- }
-};
-
-/*--------------------------------------------------------------------------*/
-
-if (!window.Element)
- var Element = new Object();
-
-Element.extend = function(element) {
- if (!element || _nativeExtensions || element.nodeType == 3) return element;
-
- if (!element._extended && element.tagName && element != window) {
- var methods = Object.clone(Element.Methods), cache = Element.extend.cache;
-
- if (element.tagName == 'FORM')
- Object.extend(methods, Form.Methods);
- if (['INPUT', 'TEXTAREA', 'SELECT'].include(element.tagName))
- Object.extend(methods, Form.Element.Methods);
-
- Object.extend(methods, Element.Methods.Simulated);
-
- for (var property in methods) {
- var value = methods[property];
- if (typeof value == 'function' && !(property in element))
- element[property] = cache.findOrStore(value);
- }
- }
-
- element._extended = true;
- return element;
-};
-
-Element.extend.cache = {
- findOrStore: function(value) {
- return this[value] = this[value] || function() {
- return value.apply(null, [this].concat($A(arguments)));
- }
- }
-};
-
-Element.Methods = {
- visible: function(element) {
- return $(element).style.display != 'none';
- },
-
- toggle: function(element) {
- element = $(element);
- Element[Element.visible(element) ? 'hide' : 'show'](element);
- return element;
- },
-
- hide: function(element) {
- $(element).style.display = 'none';
- return element;
- },
-
- show: function(element) {
- $(element).style.display = '';
- return element;
- },
-
- remove: function(element) {
- element = $(element);
- element.parentNode.removeChild(element);
- return element;
- },
-
- update: function(element, html) {
- html = typeof html == 'undefined' ? '' : html.toString();
- $(element).innerHTML = html.stripScripts();
- setTimeout(function() {html.evalScripts()}, 10);
- return element;
- },
-
- replace: function(element, html) {
- element = $(element);
- html = typeof html == 'undefined' ? '' : html.toString();
- if (element.outerHTML) {
- element.outerHTML = html.stripScripts();
- } else {
- var range = element.ownerDocument.createRange();
- range.selectNodeContents(element);
- element.parentNode.replaceChild(
- range.createContextualFragment(html.stripScripts()), element);
- }
- setTimeout(function() {html.evalScripts()}, 10);
- return element;
- },
-
- inspect: function(element) {
- element = $(element);
- var result = '<' + element.tagName.toLowerCase();
- $H({'id': 'id', 'className': 'class'}).each(function(pair) {
- var property = pair.first(), attribute = pair.last();
- var value = (element[property] || '').toString();
- if (value) result += ' ' + attribute + '=' + value.inspect(true);
- });
- return result + '>';
- },
-
- recursivelyCollect: function(element, property) {
- element = $(element);
- var elements = [];
- while (element = element[property])
- if (element.nodeType == 1)
- elements.push(Element.extend(element));
- return elements;
- },
-
- ancestors: function(element) {
- return $(element).recursivelyCollect('parentNode');
- },
-
- descendants: function(element) {
- return $A($(element).getElementsByTagName('*'));
- },
-
- immediateDescendants: function(element) {
- if (!(element = $(element).firstChild)) return [];
- while (element && element.nodeType != 1) element = element.nextSibling;
- if (element) return [element].concat($(element).nextSiblings());
- return [];
- },
-
- previousSiblings: function(element) {
- return $(element).recursivelyCollect('previousSibling');
- },
-
- nextSiblings: function(element) {
- return $(element).recursivelyCollect('nextSibling');
- },
-
- siblings: function(element) {
- element = $(element);
- return element.previousSiblings().reverse().concat(element.nextSiblings());
- },
-
- match: function(element, selector) {
- if (typeof selector == 'string')
- selector = new Selector(selector);
- return selector.match($(element));
- },
-
- up: function(element, expression, index) {
- return Selector.findElement($(element).ancestors(), expression, index);
- },
-
- down: function(element, expression, index) {
- return Selector.findElement($(element).descendants(), expression, index);
- },
-
- previous: function(element, expression, index) {
- return Selector.findElement($(element).previousSiblings(), expression, index);
- },
-
- next: function(element, expression, index) {
- return Selector.findElement($(element).nextSiblings(), expression, index);
- },
-
- getElementsBySelector: function() {
- var args = $A(arguments), element = $(args.shift());
- return Selector.findChildElements(element, args);
- },
-
- getElementsByClassName: function(element, className) {
- return document.getElementsByClassName(className, element);
- },
-
- readAttribute: function(element, name) {
- element = $(element);
- if (document.all && !window.opera) {
- var t = Element._attributeTranslations;
- if (t.values[name]) return t.values[name](element, name);
- if (t.names[name]) name = t.names[name];
- var attribute = element.attributes[name];
- if(attribute) return attribute.nodeValue;
- }
- return element.getAttribute(name);
- },
-
- getHeight: function(element) {
- return $(element).getDimensions().height;
- },
-
- getWidth: function(element) {
- return $(element).getDimensions().width;
- },
-
- classNames: function(element) {
- return new Element.ClassNames(element);
- },
-
- hasClassName: function(element, className) {
- if (!(element = $(element))) return;
- var elementClassName = element.className;
- if (elementClassName.length == 0) return false;
- if (elementClassName == className ||
- elementClassName.match(new RegExp("(^|\\s)" + className + "(\\s|$)")))
- return true;
- return false;
- },
-
- addClassName: function(element, className) {
- if (!(element = $(element))) return;
- Element.classNames(element).add(className);
- return element;
- },
-
- removeClassName: function(element, className) {
- if (!(element = $(element))) return;
- Element.classNames(element).remove(className);
- return element;
- },
-
- toggleClassName: function(element, className) {
- if (!(element = $(element))) return;
- Element.classNames(element)[element.hasClassName(className) ? 'remove' : 'add'](className);
- return element;
- },
-
- observe: function() {
- Event.observe.apply(Event, arguments);
- return $A(arguments).first();
- },
-
- stopObserving: function() {
- Event.stopObserving.apply(Event, arguments);
- return $A(arguments).first();
- },
-
- // removes whitespace-only text node children
- cleanWhitespace: function(element) {
- element = $(element);
- var node = element.firstChild;
- while (node) {
- var nextNode = node.nextSibling;
- if (node.nodeType == 3 && !/\S/.test(node.nodeValue))
- element.removeChild(node);
- node = nextNode;
- }
- return element;
- },
-
- empty: function(element) {
- return $(element).innerHTML.match(/^\s*$/);
- },
-
- descendantOf: function(element, ancestor) {
- element = $(element), ancestor = $(ancestor);
- while (element = element.parentNode)
- if (element == ancestor) return true;
- return false;
- },
-
- scrollTo: function(element) {
- element = $(element);
- var pos = Position.cumulativeOffset(element);
- window.scrollTo(pos[0], pos[1]);
- return element;
- },
-
- getStyle: function(element, style) {
- element = $(element);
- if (['float','cssFloat'].include(style))
- style = (typeof element.style.styleFloat != 'undefined' ? 'styleFloat' : 'cssFloat');
- style = style.camelize();
- var value = element.style[style];
- if (!value) {
- if (document.defaultView && document.defaultView.getComputedStyle) {
- var css = document.defaultView.getComputedStyle(element, null);
- value = css ? css[style] : null;
- } else if (element.currentStyle) {
- value = element.currentStyle[style];
- }
- }
-
- if((value == 'auto') && ['width','height'].include(style) && (element.getStyle('display') != 'none'))
- value = element['offset'+style.capitalize()] + 'px';
-
- if (window.opera && ['left', 'top', 'right', 'bottom'].include(style))
- if (Element.getStyle(element, 'position') == 'static') value = 'auto';
- if(style == 'opacity') {
- if(value) return parseFloat(value);
- if(value = (element.getStyle('filter') || '').match(/alpha\(opacity=(.*)\)/))
- if(value[1]) return parseFloat(value[1]) / 100;
- return 1.0;
- }
- return value == 'auto' ? null : value;
- },
-
- setStyle: function(element, style) {
- element = $(element);
- for (var name in style) {
- var value = style[name];
- if(name == 'opacity') {
- if (value == 1) {
- value = (/Gecko/.test(navigator.userAgent) &&
- !/Konqueror|Safari|KHTML/.test(navigator.userAgent)) ? 0.999999 : 1.0;
- if(/MSIE/.test(navigator.userAgent) && !window.opera)
- element.style.filter = element.getStyle('filter').replace(/alpha\([^\)]*\)/gi,'');
- } else if(value == '') {
- if(/MSIE/.test(navigator.userAgent) && !window.opera)
- element.style.filter = element.getStyle('filter').replace(/alpha\([^\)]*\)/gi,'');
- } else {
- if(value < 0.00001) value = 0;
- if(/MSIE/.test(navigator.userAgent) && !window.opera)
- element.style.filter = element.getStyle('filter').replace(/alpha\([^\)]*\)/gi,'') +
- 'alpha(opacity='+value*100+')';
- }
- } else if(['float','cssFloat'].include(name)) name = (typeof element.style.styleFloat != 'undefined') ? 'styleFloat' : 'cssFloat';
- element.style[name.camelize()] = value;
- }
- return element;
- },
-
- getDimensions: function(element) {
- element = $(element);
- var display = $(element).getStyle('display');
- if (display != 'none' && display != null) // Safari bug
- return {width: element.offsetWidth, height: element.offsetHeight};
-
- // All *Width and *Height properties give 0 on elements with display none,
- // so enable the element temporarily
- var els = element.style;
- var originalVisibility = els.visibility;
- var originalPosition = els.position;
- var originalDisplay = els.display;
- els.visibility = 'hidden';
- els.position = 'absolute';
- els.display = 'block';
- var originalWidth = element.clientWidth;
- var originalHeight = element.clientHeight;
- els.display = originalDisplay;
- els.position = originalPosition;
- els.visibility = originalVisibility;
- return {width: originalWidth, height: originalHeight};
- },
-
- makePositioned: function(element) {
- element = $(element);
- var pos = Element.getStyle(element, 'position');
- if (pos == 'static' || !pos) {
- element._madePositioned = true;
- element.style.position = 'relative';
- // Opera returns the offset relative to the positioning context, when an
- // element is position relative but top and left have not been defined
- if (window.opera) {
- element.style.top = 0;
- element.style.left = 0;
- }
- }
- return element;
- },
-
- undoPositioned: function(element) {
- element = $(element);
- if (element._madePositioned) {
- element._madePositioned = undefined;
- element.style.position =
- element.style.top =
- element.style.left =
- element.style.bottom =
- element.style.right = '';
- }
- return element;
- },
-
- makeClipping: function(element) {
- element = $(element);
- if (element._overflow) return element;
- element._overflow = element.style.overflow || 'auto';
- if ((Element.getStyle(element, 'overflow') || 'visible') != 'hidden')
- element.style.overflow = 'hidden';
- return element;
- },
-
- undoClipping: function(element) {
- element = $(element);
- if (!element._overflow) return element;
- element.style.overflow = element._overflow == 'auto' ? '' : element._overflow;
- element._overflow = null;
- return element;
- }
-};
-
-Object.extend(Element.Methods, {childOf: Element.Methods.descendantOf});
-
-Element._attributeTranslations = {};
-
-Element._attributeTranslations.names = {
- colspan: "colSpan",
- rowspan: "rowSpan",
- valign: "vAlign",
- datetime: "dateTime",
- accesskey: "accessKey",
- tabindex: "tabIndex",
- enctype: "encType",
- maxlength: "maxLength",
- readonly: "readOnly",
- longdesc: "longDesc"
-};
-
-Element._attributeTranslations.values = {
- _getAttr: function(element, attribute) {
- return element.getAttribute(attribute, 2);
- },
-
- _flag: function(element, attribute) {
- return $(element).hasAttribute(attribute) ? attribute : null;
- },
-
- style: function(element) {
- return element.style.cssText.toLowerCase();
- },
-
- title: function(element) {
- var node = element.getAttributeNode('title');
- return node.specified ? node.nodeValue : null;
- }
-};
-
-Object.extend(Element._attributeTranslations.values, {
- href: Element._attributeTranslations.values._getAttr,
- src: Element._attributeTranslations.values._getAttr,
- disabled: Element._attributeTranslations.values._flag,
- checked: Element._attributeTranslations.values._flag,
- readonly: Element._attributeTranslations.values._flag,
- multiple: Element._attributeTranslations.values._flag
-});
-
-Element.Methods.Simulated = {
- hasAttribute: function(element, attribute) {
- var t = Element._attributeTranslations;
- attribute = t.names[attribute] || attribute;
- return $(element).getAttributeNode(attribute).specified;
- }
-};
-
-// IE is missing .innerHTML support for TABLE-related elements
-if (document.all && !window.opera){
- Element.Methods.update = function(element, html) {
- element = $(element);
- html = typeof html == 'undefined' ? '' : html.toString();
- var tagName = element.tagName.toUpperCase();
- if (['THEAD','TBODY','TR','TD'].include(tagName)) {
- var div = document.createElement('div');
- switch (tagName) {
- case 'THEAD':
- case 'TBODY':
- div.innerHTML = '' + html.stripScripts() + '
';
- depth = 2;
- break;
- case 'TR':
- div.innerHTML = '' + html.stripScripts() + '
';
- depth = 3;
- break;
- case 'TD':
- div.innerHTML = '| ' + html.stripScripts() + ' |
';
- depth = 4;
- }
- $A(element.childNodes).each(function(node){
- element.removeChild(node)
- });
- depth.times(function(){ div = div.firstChild });
-
- $A(div.childNodes).each(
- function(node){ element.appendChild(node) });
- } else {
- element.innerHTML = html.stripScripts();
- }
- setTimeout(function() {html.evalScripts()}, 10);
- return element;
- }
-};
-
-Object.extend(Element, Element.Methods);
-
-var _nativeExtensions = false;
-
-if(/Konqueror|Safari|KHTML/.test(navigator.userAgent))
- ['', 'Form', 'Input', 'TextArea', 'Select'].each(function(tag) {
- var className = 'HTML' + tag + 'Element';
- if(window[className]) return;
- var klass = window[className] = {};
- klass.prototype = document.createElement(tag ? tag.toLowerCase() : 'div').__proto__;
- });
-
-Element.addMethods = function(methods) {
- Object.extend(Element.Methods, methods || {});
-
- function copy(methods, destination, onlyIfAbsent) {
- onlyIfAbsent = onlyIfAbsent || false;
- var cache = Element.extend.cache;
- for (var property in methods) {
- var value = methods[property];
- if (!onlyIfAbsent || !(property in destination))
- destination[property] = cache.findOrStore(value);
- }
- }
-
- if (typeof HTMLElement != 'undefined') {
- copy(Element.Methods, HTMLElement.prototype);
- copy(Element.Methods.Simulated, HTMLElement.prototype, true);
- copy(Form.Methods, HTMLFormElement.prototype);
- [HTMLInputElement, HTMLTextAreaElement, HTMLSelectElement].each(function(klass) {
- copy(Form.Element.Methods, klass.prototype);
- });
- _nativeExtensions = true;
- }
-}
-
-var Toggle = new Object();
-Toggle.display = Element.toggle;
-
-/*--------------------------------------------------------------------------*/
-
-Abstract.Insertion = function(adjacency) {
- this.adjacency = adjacency;
-}
-
-Abstract.Insertion.prototype = {
- initialize: function(element, content) {
- this.element = $(element);
- this.content = content.stripScripts();
-
- if (this.adjacency && this.element.insertAdjacentHTML) {
- try {
- this.element.insertAdjacentHTML(this.adjacency, this.content);
- } catch (e) {
- var tagName = this.element.tagName.toUpperCase();
- if (['TBODY', 'TR'].include(tagName)) {
- this.insertContent(this.contentFromAnonymousTable());
- } else {
- throw e;
- }
- }
- } else {
- this.range = this.element.ownerDocument.createRange();
- if (this.initializeRange) this.initializeRange();
- this.insertContent([this.range.createContextualFragment(this.content)]);
- }
-
- setTimeout(function() {content.evalScripts()}, 10);
- },
-
- contentFromAnonymousTable: function() {
- var div = document.createElement('div');
- div.innerHTML = '';
- return $A(div.childNodes[0].childNodes[0].childNodes);
- }
-}
-
-var Insertion = new Object();
-
-Insertion.Before = Class.create();
-Insertion.Before.prototype = Object.extend(new Abstract.Insertion('beforeBegin'), {
- initializeRange: function() {
- this.range.setStartBefore(this.element);
- },
-
- insertContent: function(fragments) {
- fragments.each((function(fragment) {
- this.element.parentNode.insertBefore(fragment, this.element);
- }).bind(this));
- }
-});
-
-Insertion.Top = Class.create();
-Insertion.Top.prototype = Object.extend(new Abstract.Insertion('afterBegin'), {
- initializeRange: function() {
- this.range.selectNodeContents(this.element);
- this.range.collapse(true);
- },
-
- insertContent: function(fragments) {
- fragments.reverse(false).each((function(fragment) {
- this.element.insertBefore(fragment, this.element.firstChild);
- }).bind(this));
- }
-});
-
-Insertion.Bottom = Class.create();
-Insertion.Bottom.prototype = Object.extend(new Abstract.Insertion('beforeEnd'), {
- initializeRange: function() {
- this.range.selectNodeContents(this.element);
- this.range.collapse(this.element);
- },
-
- insertContent: function(fragments) {
- fragments.each((function(fragment) {
- this.element.appendChild(fragment);
- }).bind(this));
- }
-});
-
-Insertion.After = Class.create();
-Insertion.After.prototype = Object.extend(new Abstract.Insertion('afterEnd'), {
- initializeRange: function() {
- this.range.setStartAfter(this.element);
- },
-
- insertContent: function(fragments) {
- fragments.each((function(fragment) {
- this.element.parentNode.insertBefore(fragment,
- this.element.nextSibling);
- }).bind(this));
- }
-});
-
-/*--------------------------------------------------------------------------*/
-
-Element.ClassNames = Class.create();
-Element.ClassNames.prototype = {
- initialize: function(element) {
- this.element = $(element);
- },
-
- _each: function(iterator) {
- this.element.className.split(/\s+/).select(function(name) {
- return name.length > 0;
- })._each(iterator);
- },
-
- set: function(className) {
- this.element.className = className;
- },
-
- add: function(classNameToAdd) {
- if (this.include(classNameToAdd)) return;
- this.set($A(this).concat(classNameToAdd).join(' '));
- },
-
- remove: function(classNameToRemove) {
- if (!this.include(classNameToRemove)) return;
- this.set($A(this).without(classNameToRemove).join(' '));
- },
-
- toString: function() {
- return $A(this).join(' ');
- }
-};
-
-Object.extend(Element.ClassNames.prototype, Enumerable);
-var Selector = Class.create();
-Selector.prototype = {
- initialize: function(expression) {
- this.params = {classNames: []};
- this.expression = expression.toString().strip();
- this.parseExpression();
- this.compileMatcher();
- },
-
- parseExpression: function() {
- function abort(message) { throw 'Parse error in selector: ' + message; }
-
- if (this.expression == '') abort('empty expression');
-
- var params = this.params, expr = this.expression, match, modifier, clause, rest;
- while (match = expr.match(/^(.*)\[([a-z0-9_:-]+?)(?:([~\|!]?=)(?:"([^"]*)"|([^\]\s]*)))?\]$/i)) {
- params.attributes = params.attributes || [];
- params.attributes.push({name: match[2], operator: match[3], value: match[4] || match[5] || ''});
- expr = match[1];
- }
-
- if (expr == '*') return this.params.wildcard = true;
-
- while (match = expr.match(/^([^a-z0-9_-])?([a-z0-9_-]+)(.*)/i)) {
- modifier = match[1], clause = match[2], rest = match[3];
- switch (modifier) {
- case '#': params.id = clause; break;
- case '.': params.classNames.push(clause); break;
- case '':
- case undefined: params.tagName = clause.toUpperCase(); break;
- default: abort(expr.inspect());
- }
- expr = rest;
- }
-
- if (expr.length > 0) abort(expr.inspect());
- },
-
- buildMatchExpression: function() {
- var params = this.params, conditions = [], clause;
-
- if (params.wildcard)
- conditions.push('true');
- if (clause = params.id)
- conditions.push('element.readAttribute("id") == ' + clause.inspect());
- if (clause = params.tagName)
- conditions.push('element.tagName.toUpperCase() == ' + clause.inspect());
- if ((clause = params.classNames).length > 0)
- for (var i = 0, length = clause.length; i < length; i++)
- conditions.push('element.hasClassName(' + clause[i].inspect() + ')');
- if (clause = params.attributes) {
- clause.each(function(attribute) {
- var value = 'element.readAttribute(' + attribute.name.inspect() + ')';
- var splitValueBy = function(delimiter) {
- return value + ' && ' + value + '.split(' + delimiter.inspect() + ')';
- }
-
- switch (attribute.operator) {
- case '=': conditions.push(value + ' == ' + attribute.value.inspect()); break;
- case '~=': conditions.push(splitValueBy(' ') + '.include(' + attribute.value.inspect() + ')'); break;
- case '|=': conditions.push(
- splitValueBy('-') + '.first().toUpperCase() == ' + attribute.value.toUpperCase().inspect()
- ); break;
- case '!=': conditions.push(value + ' != ' + attribute.value.inspect()); break;
- case '':
- case undefined: conditions.push('element.hasAttribute(' + attribute.name.inspect() + ')'); break;
- default: throw 'Unknown operator ' + attribute.operator + ' in selector';
- }
- });
- }
-
- return conditions.join(' && ');
- },
-
- compileMatcher: function() {
- this.match = new Function('element', 'if (!element.tagName) return false; \
- element = $(element); \
- return ' + this.buildMatchExpression());
- },
-
- findElements: function(scope) {
- var element;
-
- if (element = $(this.params.id))
- if (this.match(element))
- if (!scope || Element.childOf(element, scope))
- return [element];
-
- scope = (scope || document).getElementsByTagName(this.params.tagName || '*');
-
- var results = [];
- for (var i = 0, length = scope.length; i < length; i++)
- if (this.match(element = scope[i]))
- results.push(Element.extend(element));
-
- return results;
- },
-
- toString: function() {
- return this.expression;
- }
-}
-
-Object.extend(Selector, {
- matchElements: function(elements, expression) {
- var selector = new Selector(expression);
- return elements.select(selector.match.bind(selector)).map(Element.extend);
- },
-
- findElement: function(elements, expression, index) {
- if (typeof expression == 'number') index = expression, expression = false;
- return Selector.matchElements(elements, expression || '*')[index || 0];
- },
-
- findChildElements: function(element, expressions) {
- return expressions.map(function(expression) {
- return expression.match(/[^\s"]+(?:"[^"]*"[^\s"]+)*/g).inject([null], function(results, expr) {
- var selector = new Selector(expr);
- return results.inject([], function(elements, result) {
- return elements.concat(selector.findElements(result || element));
- });
- });
- }).flatten();
- }
-});
-
-function $$() {
- return Selector.findChildElements(document, $A(arguments));
-}
-var Form = {
- reset: function(form) {
- $(form).reset();
- return form;
- },
-
- serializeElements: function(elements, getHash) {
- var data = elements.inject({}, function(result, element) {
- if (!element.disabled && element.name) {
- var key = element.name, value = $(element).getValue();
- if (value != undefined) {
- if (result[key]) {
- if (result[key].constructor != Array) result[key] = [result[key]];
- result[key].push(value);
- }
- else result[key] = value;
- }
- }
- return result;
- });
-
- return getHash ? data : Hash.toQueryString(data);
- }
-};
-
-Form.Methods = {
- serialize: function(form, getHash) {
- return Form.serializeElements(Form.getElements(form), getHash);
- },
-
- getElements: function(form) {
- return $A($(form).getElementsByTagName('*')).inject([],
- function(elements, child) {
- if (Form.Element.Serializers[child.tagName.toLowerCase()])
- elements.push(Element.extend(child));
- return elements;
- }
- );
- },
-
- getInputs: function(form, typeName, name) {
- form = $(form);
- var inputs = form.getElementsByTagName('input');
-
- if (!typeName && !name) return $A(inputs).map(Element.extend);
-
- for (var i = 0, matchingInputs = [], length = inputs.length; i < length; i++) {
- var input = inputs[i];
- if ((typeName && input.type != typeName) || (name && input.name != name))
- continue;
- matchingInputs.push(Element.extend(input));
- }
-
- return matchingInputs;
- },
-
- disable: function(form) {
- form = $(form);
- form.getElements().each(function(element) {
- element.blur();
- element.disabled = 'true';
- });
- return form;
- },
-
- enable: function(form) {
- form = $(form);
- form.getElements().each(function(element) {
- element.disabled = '';
- });
- return form;
- },
-
- findFirstElement: function(form) {
- return $(form).getElements().find(function(element) {
- return element.type != 'hidden' && !element.disabled &&
- ['input', 'select', 'textarea'].include(element.tagName.toLowerCase());
- });
- },
-
- focusFirstElement: function(form) {
- form = $(form);
- form.findFirstElement().activate();
- return form;
- }
-}
-
-Object.extend(Form, Form.Methods);
-
-/*--------------------------------------------------------------------------*/
-
-Form.Element = {
- focus: function(element) {
- $(element).focus();
- return element;
- },
-
- select: function(element) {
- $(element).select();
- return element;
- }
-}
-
-Form.Element.Methods = {
- serialize: function(element) {
- element = $(element);
- if (!element.disabled && element.name) {
- var value = element.getValue();
- if (value != undefined) {
- var pair = {};
- pair[element.name] = value;
- return Hash.toQueryString(pair);
- }
- }
- return '';
- },
-
- getValue: function(element) {
- element = $(element);
- var method = element.tagName.toLowerCase();
- return Form.Element.Serializers[method](element);
- },
-
- clear: function(element) {
- $(element).value = '';
- return element;
- },
-
- present: function(element) {
- return $(element).value != '';
- },
-
- activate: function(element) {
- element = $(element);
- element.focus();
- if (element.select && ( element.tagName.toLowerCase() != 'input' ||
- !['button', 'reset', 'submit'].include(element.type) ) )
- element.select();
- return element;
- },
-
- disable: function(element) {
- element = $(element);
- element.disabled = true;
- return element;
- },
-
- enable: function(element) {
- element = $(element);
- element.blur();
- element.disabled = false;
- return element;
- }
-}
-
-Object.extend(Form.Element, Form.Element.Methods);
-var Field = Form.Element;
-var $F = Form.Element.getValue;
-
-/*--------------------------------------------------------------------------*/
-
-Form.Element.Serializers = {
- input: function(element) {
- switch (element.type.toLowerCase()) {
- case 'checkbox':
- case 'radio':
- return Form.Element.Serializers.inputSelector(element);
- default:
- return Form.Element.Serializers.textarea(element);
- }
- },
-
- inputSelector: function(element) {
- return element.checked ? element.value : null;
- },
-
- textarea: function(element) {
- return element.value;
- },
-
- select: function(element) {
- return this[element.type == 'select-one' ?
- 'selectOne' : 'selectMany'](element);
- },
-
- selectOne: function(element) {
- var index = element.selectedIndex;
- return index >= 0 ? this.optionValue(element.options[index]) : null;
- },
-
- selectMany: function(element) {
- var values, length = element.length;
- if (!length) return null;
-
- for (var i = 0, values = []; i < length; i++) {
- var opt = element.options[i];
- if (opt.selected) values.push(this.optionValue(opt));
- }
- return values;
- },
-
- optionValue: function(opt) {
- // extend element because hasAttribute may not be native
- return Element.extend(opt).hasAttribute('value') ? opt.value : opt.text;
- }
-}
-
-/*--------------------------------------------------------------------------*/
-
-Abstract.TimedObserver = function() {}
-Abstract.TimedObserver.prototype = {
- initialize: function(element, frequency, callback) {
- this.frequency = frequency;
- this.element = $(element);
- this.callback = callback;
-
- this.lastValue = this.getValue();
- this.registerCallback();
- },
-
- registerCallback: function() {
- setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
- },
-
- onTimerEvent: function() {
- var value = this.getValue();
- var changed = ('string' == typeof this.lastValue && 'string' == typeof value
- ? this.lastValue != value : String(this.lastValue) != String(value));
- if (changed) {
- this.callback(this.element, value);
- this.lastValue = value;
- }
- }
-}
-
-Form.Element.Observer = Class.create();
-Form.Element.Observer.prototype = Object.extend(new Abstract.TimedObserver(), {
- getValue: function() {
- return Form.Element.getValue(this.element);
- }
-});
-
-Form.Observer = Class.create();
-Form.Observer.prototype = Object.extend(new Abstract.TimedObserver(), {
- getValue: function() {
- return Form.serialize(this.element);
- }
-});
-
-/*--------------------------------------------------------------------------*/
-
-Abstract.EventObserver = function() {}
-Abstract.EventObserver.prototype = {
- initialize: function(element, callback) {
- this.element = $(element);
- this.callback = callback;
-
- this.lastValue = this.getValue();
- if (this.element.tagName.toLowerCase() == 'form')
- this.registerFormCallbacks();
- else
- this.registerCallback(this.element);
- },
-
- onElementEvent: function() {
- var value = this.getValue();
- if (this.lastValue != value) {
- this.callback(this.element, value);
- this.lastValue = value;
- }
- },
-
- registerFormCallbacks: function() {
- Form.getElements(this.element).each(this.registerCallback.bind(this));
- },
-
- registerCallback: function(element) {
- if (element.type) {
- switch (element.type.toLowerCase()) {
- case 'checkbox':
- case 'radio':
- Event.observe(element, 'click', this.onElementEvent.bind(this));
- break;
- default:
- Event.observe(element, 'change', this.onElementEvent.bind(this));
- break;
- }
- }
- }
-}
-
-Form.Element.EventObserver = Class.create();
-Form.Element.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), {
- getValue: function() {
- return Form.Element.getValue(this.element);
- }
-});
-
-Form.EventObserver = Class.create();
-Form.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), {
- getValue: function() {
- return Form.serialize(this.element);
- }
-});
-if (!window.Event) {
- var Event = new Object();
-}
-
-Object.extend(Event, {
- KEY_BACKSPACE: 8,
- KEY_TAB: 9,
- KEY_RETURN: 13,
- KEY_ESC: 27,
- KEY_LEFT: 37,
- KEY_UP: 38,
- KEY_RIGHT: 39,
- KEY_DOWN: 40,
- KEY_DELETE: 46,
- KEY_HOME: 36,
- KEY_END: 35,
- KEY_PAGEUP: 33,
- KEY_PAGEDOWN: 34,
-
- element: function(event) {
- return event.target || event.srcElement;
- },
-
- isLeftClick: function(event) {
- return (((event.which) && (event.which == 1)) ||
- ((event.button) && (event.button == 1)));
- },
-
- pointerX: function(event) {
- return event.pageX || (event.clientX +
- (document.documentElement.scrollLeft || document.body.scrollLeft));
- },
-
- pointerY: function(event) {
- return event.pageY || (event.clientY +
- (document.documentElement.scrollTop || document.body.scrollTop));
- },
-
- stop: function(event) {
- if (event.preventDefault) {
- event.preventDefault();
- event.stopPropagation();
- } else {
- event.returnValue = false;
- event.cancelBubble = true;
- }
- },
-
- // find the first node with the given tagName, starting from the
- // node the event was triggered on; traverses the DOM upwards
- findElement: function(event, tagName) {
- var element = Event.element(event);
- while (element.parentNode && (!element.tagName ||
- (element.tagName.toUpperCase() != tagName.toUpperCase())))
- element = element.parentNode;
- return element;
- },
-
- observers: false,
-
- _observeAndCache: function(element, name, observer, useCapture) {
- if (!this.observers) this.observers = [];
- if (element.addEventListener) {
- this.observers.push([element, name, observer, useCapture]);
- element.addEventListener(name, observer, useCapture);
- } else if (element.attachEvent) {
- this.observers.push([element, name, observer, useCapture]);
- element.attachEvent('on' + name, observer);
- }
- },
-
- unloadCache: function() {
- if (!Event.observers) return;
- for (var i = 0, length = Event.observers.length; i < length; i++) {
- Event.stopObserving.apply(this, Event.observers[i]);
- Event.observers[i][0] = null;
- }
- Event.observers = false;
- },
-
- observe: function(element, name, observer, useCapture) {
- element = $(element);
- useCapture = useCapture || false;
-
- if (name == 'keypress' &&
- (navigator.appVersion.match(/Konqueror|Safari|KHTML/)
- || element.attachEvent))
- name = 'keydown';
-
- Event._observeAndCache(element, name, observer, useCapture);
- },
-
- stopObserving: function(element, name, observer, useCapture) {
- element = $(element);
- useCapture = useCapture || false;
-
- if (name == 'keypress' &&
- (navigator.appVersion.match(/Konqueror|Safari|KHTML/)
- || element.detachEvent))
- name = 'keydown';
-
- if (element.removeEventListener) {
- element.removeEventListener(name, observer, useCapture);
- } else if (element.detachEvent) {
- try {
- element.detachEvent('on' + name, observer);
- } catch (e) {}
- }
- }
-});
-
-/* prevent memory leaks in IE */
-if (navigator.appVersion.match(/\bMSIE\b/))
- Event.observe(window, 'unload', Event.unloadCache, false);
-var Position = {
- // set to true if needed, warning: firefox performance problems
- // NOT neeeded for page scrolling, only if draggable contained in
- // scrollable elements
- includeScrollOffsets: false,
-
- // must be called before calling withinIncludingScrolloffset, every time the
- // page is scrolled
- prepare: function() {
- this.deltaX = window.pageXOffset
- || document.documentElement.scrollLeft
- || document.body.scrollLeft
- || 0;
- this.deltaY = window.pageYOffset
- || document.documentElement.scrollTop
- || document.body.scrollTop
- || 0;
- },
-
- realOffset: function(element) {
- var valueT = 0, valueL = 0;
- do {
- valueT += element.scrollTop || 0;
- valueL += element.scrollLeft || 0;
- element = element.parentNode;
- } while (element);
- return [valueL, valueT];
- },
-
- cumulativeOffset: function(element) {
- var valueT = 0, valueL = 0;
- do {
- valueT += element.offsetTop || 0;
- valueL += element.offsetLeft || 0;
- element = element.offsetParent;
- } while (element);
- return [valueL, valueT];
- },
-
- positionedOffset: function(element) {
- var valueT = 0, valueL = 0;
- do {
- valueT += element.offsetTop || 0;
- valueL += element.offsetLeft || 0;
- element = element.offsetParent;
- if (element) {
- if(element.tagName=='BODY') break;
- var p = Element.getStyle(element, 'position');
- if (p == 'relative' || p == 'absolute') break;
- }
- } while (element);
- return [valueL, valueT];
- },
-
- offsetParent: function(element) {
- if (element.offsetParent) return element.offsetParent;
- if (element == document.body) return element;
-
- while ((element = element.parentNode) && element != document.body)
- if (Element.getStyle(element, 'position') != 'static')
- return element;
-
- return document.body;
- },
-
- // caches x/y coordinate pair to use with overlap
- within: function(element, x, y) {
- if (this.includeScrollOffsets)
- return this.withinIncludingScrolloffsets(element, x, y);
- this.xcomp = x;
- this.ycomp = y;
- this.offset = this.cumulativeOffset(element);
-
- return (y >= this.offset[1] &&
- y < this.offset[1] + element.offsetHeight &&
- x >= this.offset[0] &&
- x < this.offset[0] + element.offsetWidth);
- },
-
- withinIncludingScrolloffsets: function(element, x, y) {
- var offsetcache = this.realOffset(element);
-
- this.xcomp = x + offsetcache[0] - this.deltaX;
- this.ycomp = y + offsetcache[1] - this.deltaY;
- this.offset = this.cumulativeOffset(element);
-
- return (this.ycomp >= this.offset[1] &&
- this.ycomp < this.offset[1] + element.offsetHeight &&
- this.xcomp >= this.offset[0] &&
- this.xcomp < this.offset[0] + element.offsetWidth);
- },
-
- // within must be called directly before
- overlap: function(mode, element) {
- if (!mode) return 0;
- if (mode == 'vertical')
- return ((this.offset[1] + element.offsetHeight) - this.ycomp) /
- element.offsetHeight;
- if (mode == 'horizontal')
- return ((this.offset[0] + element.offsetWidth) - this.xcomp) /
- element.offsetWidth;
- },
-
- page: function(forElement) {
- var valueT = 0, valueL = 0;
-
- var element = forElement;
- do {
- valueT += element.offsetTop || 0;
- valueL += element.offsetLeft || 0;
-
- // Safari fix
- if (element.offsetParent==document.body)
- if (Element.getStyle(element,'position')=='absolute') break;
-
- } while (element = element.offsetParent);
-
- element = forElement;
- do {
- if (!window.opera || element.tagName=='BODY') {
- valueT -= element.scrollTop || 0;
- valueL -= element.scrollLeft || 0;
- }
- } while (element = element.parentNode);
-
- return [valueL, valueT];
- },
-
- clone: function(source, target) {
- var options = Object.extend({
- setLeft: true,
- setTop: true,
- setWidth: true,
- setHeight: true,
- offsetTop: 0,
- offsetLeft: 0
- }, arguments[2] || {})
-
- // find page position of source
- source = $(source);
- var p = Position.page(source);
-
- // find coordinate system to use
- target = $(target);
- var delta = [0, 0];
- var parent = null;
- // delta [0,0] will do fine with position: fixed elements,
- // position:absolute needs offsetParent deltas
- if (Element.getStyle(target,'position') == 'absolute') {
- parent = Position.offsetParent(target);
- delta = Position.page(parent);
- }
-
- // correct by body offsets (fixes Safari)
- if (parent == document.body) {
- delta[0] -= document.body.offsetLeft;
- delta[1] -= document.body.offsetTop;
- }
-
- // set position
- if(options.setLeft) target.style.left = (p[0] - delta[0] + options.offsetLeft) + 'px';
- if(options.setTop) target.style.top = (p[1] - delta[1] + options.offsetTop) + 'px';
- if(options.setWidth) target.style.width = source.offsetWidth + 'px';
- if(options.setHeight) target.style.height = source.offsetHeight + 'px';
- },
-
- absolutize: function(element) {
- element = $(element);
- if (element.style.position == 'absolute') return;
- Position.prepare();
-
- var offsets = Position.positionedOffset(element);
- var top = offsets[1];
- var left = offsets[0];
- var width = element.clientWidth;
- var height = element.clientHeight;
-
- element._originalLeft = left - parseFloat(element.style.left || 0);
- element._originalTop = top - parseFloat(element.style.top || 0);
- element._originalWidth = element.style.width;
- element._originalHeight = element.style.height;
-
- element.style.position = 'absolute';
- element.style.top = top + 'px';
- element.style.left = left + 'px';
- element.style.width = width + 'px';
- element.style.height = height + 'px';
- },
-
- relativize: function(element) {
- element = $(element);
- if (element.style.position == 'relative') return;
- Position.prepare();
-
- element.style.position = 'relative';
- var top = parseFloat(element.style.top || 0) - (element._originalTop || 0);
- var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0);
-
- element.style.top = top + 'px';
- element.style.left = left + 'px';
- element.style.height = element._originalHeight;
- element.style.width = element._originalWidth;
- }
-}
-
-// Safari returns margins on body which is incorrect if the child is absolutely
-// positioned. For performance reasons, redefine Position.cumulativeOffset for
-// KHTML/WebKit only.
-if (/Konqueror|Safari|KHTML/.test(navigator.userAgent)) {
- Position.cumulativeOffset = function(element) {
- var valueT = 0, valueL = 0;
- do {
- valueT += element.offsetTop || 0;
- valueL += element.offsetLeft || 0;
- if (element.offsetParent == document.body)
- if (Element.getStyle(element, 'position') == 'absolute') break;
-
- element = element.offsetParent;
- } while (element);
-
- return [valueL, valueT];
- }
-}
-
-Element.addMethods();
\ No newline at end of file
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/public/robots.txt b/vendor/gems/has_many_polymorphs-2.13/test/integration/app/public/robots.txt
deleted file mode 100644
index 4ab9e89f..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/public/robots.txt
+++ /dev/null
@@ -1 +0,0 @@
-# See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
\ No newline at end of file
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/public/stylesheets/scaffold.css b/vendor/gems/has_many_polymorphs-2.13/test/integration/app/public/stylesheets/scaffold.css
deleted file mode 100644
index 8f239a35..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/public/stylesheets/scaffold.css
+++ /dev/null
@@ -1,74 +0,0 @@
-body { background-color: #fff; color: #333; }
-
-body, p, ol, ul, td {
- font-family: verdana, arial, helvetica, sans-serif;
- font-size: 13px;
- line-height: 18px;
-}
-
-pre {
- background-color: #eee;
- padding: 10px;
- font-size: 11px;
-}
-
-a { color: #000; }
-a:visited { color: #666; }
-a:hover { color: #fff; background-color:#000; }
-
-.fieldWithErrors {
- padding: 2px;
- background-color: red;
- display: table;
-}
-
-#errorExplanation {
- width: 400px;
- border: 2px solid red;
- padding: 7px;
- padding-bottom: 12px;
- margin-bottom: 20px;
- background-color: #f0f0f0;
-}
-
-#errorExplanation h2 {
- text-align: left;
- font-weight: bold;
- padding: 5px 5px 5px 15px;
- font-size: 12px;
- margin: -7px;
- background-color: #c00;
- color: #fff;
-}
-
-#errorExplanation p {
- color: #333;
- margin-bottom: 0;
- padding: 5px;
-}
-
-#errorExplanation ul li {
- font-size: 12px;
- list-style: square;
-}
-
-div.uploadStatus {
- margin: 5px;
-}
-
-div.progressBar {
- margin: 5px;
-}
-
-div.progressBar div.border {
- background-color: #fff;
- border: 1px solid grey;
- width: 100%;
-}
-
-div.progressBar div.background {
- background-color: #333;
- height: 18px;
- width: 0%;
-}
-
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/script/about b/vendor/gems/has_many_polymorphs-2.13/test/integration/app/script/about
deleted file mode 100755
index 7b07d46a..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/script/about
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../config/boot'
-require 'commands/about'
\ No newline at end of file
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/script/breakpointer b/vendor/gems/has_many_polymorphs-2.13/test/integration/app/script/breakpointer
deleted file mode 100755
index 64af76ed..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/script/breakpointer
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../config/boot'
-require 'commands/breakpointer'
\ No newline at end of file
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/script/console b/vendor/gems/has_many_polymorphs-2.13/test/integration/app/script/console
deleted file mode 100755
index 42f28f7d..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/script/console
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../config/boot'
-require 'commands/console'
\ No newline at end of file
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/script/destroy b/vendor/gems/has_many_polymorphs-2.13/test/integration/app/script/destroy
deleted file mode 100755
index fa0e6fcd..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/script/destroy
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../config/boot'
-require 'commands/destroy'
\ No newline at end of file
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/script/generate b/vendor/gems/has_many_polymorphs-2.13/test/integration/app/script/generate
deleted file mode 100755
index ef976e09..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/script/generate
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../config/boot'
-require 'commands/generate'
\ No newline at end of file
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/script/performance/benchmarker b/vendor/gems/has_many_polymorphs-2.13/test/integration/app/script/performance/benchmarker
deleted file mode 100755
index c842d35d..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/script/performance/benchmarker
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../../config/boot'
-require 'commands/performance/benchmarker'
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/script/performance/profiler b/vendor/gems/has_many_polymorphs-2.13/test/integration/app/script/performance/profiler
deleted file mode 100755
index d855ac8b..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/script/performance/profiler
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../../config/boot'
-require 'commands/performance/profiler'
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/script/plugin b/vendor/gems/has_many_polymorphs-2.13/test/integration/app/script/plugin
deleted file mode 100755
index 26ca64c0..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/script/plugin
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../config/boot'
-require 'commands/plugin'
\ No newline at end of file
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/script/process/inspector b/vendor/gems/has_many_polymorphs-2.13/test/integration/app/script/process/inspector
deleted file mode 100755
index bf25ad86..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/script/process/inspector
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../../config/boot'
-require 'commands/process/inspector'
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/script/process/reaper b/vendor/gems/has_many_polymorphs-2.13/test/integration/app/script/process/reaper
deleted file mode 100755
index c77f0453..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/script/process/reaper
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../../config/boot'
-require 'commands/process/reaper'
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/script/process/spawner b/vendor/gems/has_many_polymorphs-2.13/test/integration/app/script/process/spawner
deleted file mode 100755
index 7118f398..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/script/process/spawner
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../../config/boot'
-require 'commands/process/spawner'
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/script/runner b/vendor/gems/has_many_polymorphs-2.13/test/integration/app/script/runner
deleted file mode 100755
index ccc30f9d..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/script/runner
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../config/boot'
-require 'commands/runner'
\ No newline at end of file
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/script/server b/vendor/gems/has_many_polymorphs-2.13/test/integration/app/script/server
deleted file mode 100755
index dfabcb88..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/script/server
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../config/boot'
-require 'commands/server'
\ No newline at end of file
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/fixtures/double_sti_parent_relationships.yml b/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/fixtures/double_sti_parent_relationships.yml
deleted file mode 100644
index 5bf02933..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/fixtures/double_sti_parent_relationships.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
-
-# one:
-# column: value
-#
-# two:
-# column: value
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/fixtures/double_sti_parents.yml b/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/fixtures/double_sti_parents.yml
deleted file mode 100644
index 5bf02933..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/fixtures/double_sti_parents.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
-
-# one:
-# column: value
-#
-# two:
-# column: value
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/fixtures/organic_substances.yml b/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/fixtures/organic_substances.yml
deleted file mode 100644
index 123ef537..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/fixtures/organic_substances.yml
+++ /dev/null
@@ -1,5 +0,0 @@
-one:
- type: Bone
-
-two:
- type: Bone
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/fixtures/single_sti_parent_relationships.yml b/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/fixtures/single_sti_parent_relationships.yml
deleted file mode 100644
index 5bf02933..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/fixtures/single_sti_parent_relationships.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
-
-# one:
-# column: value
-#
-# two:
-# column: value
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/fixtures/single_sti_parents.yml b/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/fixtures/single_sti_parents.yml
deleted file mode 100644
index 5bf02933..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/fixtures/single_sti_parents.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
-
-# one:
-# column: value
-#
-# two:
-# column: value
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/fixtures/sticks.yml b/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/fixtures/sticks.yml
deleted file mode 100644
index 157d7472..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/fixtures/sticks.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
-
-one:
- name: MyString
-
-two:
- name: MyString
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/fixtures/stones.yml b/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/fixtures/stones.yml
deleted file mode 100644
index 157d7472..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/fixtures/stones.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
-
-one:
- name: MyString
-
-two:
- name: MyString
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/functional/addresses_controller_test.rb b/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/functional/addresses_controller_test.rb
deleted file mode 100644
index 65284b5b..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/functional/addresses_controller_test.rb
+++ /dev/null
@@ -1,57 +0,0 @@
-require File.dirname(__FILE__) + '/../test_helper'
-require 'addresses_controller'
-
-# Re-raise errors caught by the controller.
-class AddressesController; def rescue_action(e) raise e end; end
-
-class AddressesControllerTest < Test::Unit::TestCase
- fixtures :addresses
-
- def setup
- @controller = AddressesController.new
- @request = ActionController::TestRequest.new
- @response = ActionController::TestResponse.new
- end
-
- def test_should_get_index
- get :index
- assert_response :success
- assert assigns(:addresses)
- end
-
- def test_should_get_new
- get :new
- assert_response :success
- end
-
- def test_should_create_address
- assert_difference('Address.count') do
- post :create, :address => { :country_id => 1, :user_id => 1, :state_id => 1}
- end
-
- assert_redirected_to address_path(assigns(:address))
- end
-
- def test_should_show_address
- get :show, :id => 1
- assert_response :success
- end
-
- def test_should_get_edit
- get :edit, :id => 1
- assert_response :success
- end
-
- def test_should_update_address
- put :update, :id => 1, :address => { }
- assert_redirected_to address_path(assigns(:address))
- end
-
- def test_should_destroy_address
- assert_difference('Address.count', -1) do
- delete :destroy, :id => 1
- end
-
- assert_redirected_to addresses_path
- end
-end
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/functional/bones_controller_test.rb b/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/functional/bones_controller_test.rb
deleted file mode 100644
index fc0c7bd8..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/functional/bones_controller_test.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-require File.dirname(__FILE__) + '/../test_helper'
-
-class BonesControllerTest < ActionController::TestCase
- # Replace this with your real tests.
- def test_truth
- assert true
- end
-end
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/functional/sellers_controller_test.rb b/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/functional/sellers_controller_test.rb
deleted file mode 100644
index fb992e5d..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/functional/sellers_controller_test.rb
+++ /dev/null
@@ -1,57 +0,0 @@
-require File.dirname(__FILE__) + '/../test_helper'
-require 'sellers_controller'
-
-# Re-raise errors caught by the controller.
-class SellersController; def rescue_action(e) raise e end; end
-
-class SellersControllerTest < Test::Unit::TestCase
- fixtures :sellers
-
- def setup
- @controller = SellersController.new
- @request = ActionController::TestRequest.new
- @response = ActionController::TestResponse.new
- end
-
- def test_should_get_index
- get :index
- assert_response :success
- assert assigns(:sellers)
- end
-
- def test_should_get_new
- get :new
- assert_response :success
- end
-
- def test_should_create_seller
- assert_difference('Seller.count') do
- post :create, :seller => { }
- end
-
- assert_redirected_to seller_path(assigns(:seller))
- end
-
- def test_should_show_seller
- get :show, :id => 1
- assert_response :success
- end
-
- def test_should_get_edit
- get :edit, :id => 1
- assert_response :success
- end
-
- def test_should_update_seller
- put :update, :id => 1, :seller => { }
- assert_redirected_to seller_path(assigns(:seller))
- end
-
- def test_should_destroy_seller
- assert_difference('Seller.count', -1) do
- delete :destroy, :id => 1
- end
-
- assert_redirected_to sellers_path
- end
-end
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/functional/states_controller_test.rb b/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/functional/states_controller_test.rb
deleted file mode 100644
index 2e93453b..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/functional/states_controller_test.rb
+++ /dev/null
@@ -1,57 +0,0 @@
-require File.dirname(__FILE__) + '/../test_helper'
-require 'states_controller'
-
-# Re-raise errors caught by the controller.
-class StatesController; def rescue_action(e) raise e end; end
-
-class StatesControllerTest < Test::Unit::TestCase
- fixtures :states
-
- def setup
- @controller = StatesController.new
- @request = ActionController::TestRequest.new
- @response = ActionController::TestResponse.new
- end
-
- def test_should_get_index
- get :index
- assert_response :success
- assert assigns(:states)
- end
-
- def test_should_get_new
- get :new
- assert_response :success
- end
-
- def test_should_create_state
- assert_difference('State.count') do
- post :create, :state => { }
- end
-
- assert_redirected_to state_path(assigns(:state))
- end
-
- def test_should_show_state
- get :show, :id => 1
- assert_response :success
- end
-
- def test_should_get_edit
- get :edit, :id => 1
- assert_response :success
- end
-
- def test_should_update_state
- put :update, :id => 1, :state => { }
- assert_redirected_to state_path(assigns(:state))
- end
-
- def test_should_destroy_state
- assert_difference('State.count', -1) do
- delete :destroy, :id => 1
- end
-
- assert_redirected_to states_path
- end
-end
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/functional/users_controller_test.rb b/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/functional/users_controller_test.rb
deleted file mode 100644
index bc36751f..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/functional/users_controller_test.rb
+++ /dev/null
@@ -1,57 +0,0 @@
-require File.dirname(__FILE__) + '/../test_helper'
-require 'users_controller'
-
-# Re-raise errors caught by the controller.
-class UsersController; def rescue_action(e) raise e end; end
-
-class UsersControllerTest < Test::Unit::TestCase
- fixtures :users
-
- def setup
- @controller = UsersController.new
- @request = ActionController::TestRequest.new
- @response = ActionController::TestResponse.new
- end
-
- def test_should_get_index
- get :index
- assert_response :success
- assert assigns(:users)
- end
-
- def test_should_get_new
- get :new
- assert_response :success
- end
-
- def test_should_create_user
- assert_difference('User.count') do
- post :create, :user => { }
- end
-
- assert_redirected_to user_path(assigns(:user))
- end
-
- def test_should_show_user
- get :show, :id => 1
- assert_response :success
- end
-
- def test_should_get_edit
- get :edit, :id => 1
- assert_response :success
- end
-
- def test_should_update_user
- put :update, :id => 1, :user => { }
- assert_redirected_to user_path(assigns(:user))
- end
-
- def test_should_destroy_user
- assert_difference('User.count', -1) do
- delete :destroy, :id => 1
- end
-
- assert_redirected_to users_path
- end
-end
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/test_helper.rb b/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/test_helper.rb
deleted file mode 100644
index 773c49de..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/test_helper.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-ENV["RAILS_ENV"] = "development"
-require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
-require 'test_help'
-
-class Test::Unit::TestCase
- self.use_transactional_fixtures = true
- self.use_instantiated_fixtures = false
-end
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/unit/bone_test.rb b/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/unit/bone_test.rb
deleted file mode 100644
index 8afcb87b..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/unit/bone_test.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-require File.dirname(__FILE__) + '/../test_helper'
-
-class BoneTest < Test::Unit::TestCase
- # Replace this with your real tests.
- def test_truth
- assert true
- end
-end
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/unit/double_sti_parent_relationship_test.rb b/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/unit/double_sti_parent_relationship_test.rb
deleted file mode 100644
index dc20e74d..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/unit/double_sti_parent_relationship_test.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-require File.dirname(__FILE__) + '/../test_helper'
-
-class DoubleStiParentRelationshipTest < Test::Unit::TestCase
- # Replace this with your real tests.
- def test_truth
- assert true
- end
-end
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/unit/double_sti_parent_test.rb b/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/unit/double_sti_parent_test.rb
deleted file mode 100644
index 154383a2..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/unit/double_sti_parent_test.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-require File.dirname(__FILE__) + '/../test_helper'
-
-class DoubleStiParentTest < Test::Unit::TestCase
- # Replace this with your real tests.
- def test_truth
- assert true
- end
-end
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/unit/organic_substance_test.rb b/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/unit/organic_substance_test.rb
deleted file mode 100644
index af328b95..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/unit/organic_substance_test.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-require File.dirname(__FILE__) + '/../test_helper'
-
-class OrganicSubstanceTest < Test::Unit::TestCase
- # Replace this with your real tests.
- def test_truth
- assert true
- end
-end
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/unit/single_sti_parent_relationship_test.rb b/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/unit/single_sti_parent_relationship_test.rb
deleted file mode 100644
index d5563fd8..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/unit/single_sti_parent_relationship_test.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-require File.dirname(__FILE__) + '/../test_helper'
-
-class SingleStiParentRelationshipTest < Test::Unit::TestCase
- # Replace this with your real tests.
- def test_truth
- assert true
- end
-end
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/unit/single_sti_parent_test.rb b/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/unit/single_sti_parent_test.rb
deleted file mode 100644
index 70a00ecb..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/unit/single_sti_parent_test.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-require File.dirname(__FILE__) + '/../test_helper'
-
-class SingleStiParentTest < Test::Unit::TestCase
- # Replace this with your real tests.
- def test_truth
- assert true
- end
-end
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/unit/stick_test.rb b/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/unit/stick_test.rb
deleted file mode 100644
index 6729e0d6..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/unit/stick_test.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-require File.dirname(__FILE__) + '/../test_helper'
-
-class StickTest < Test::Unit::TestCase
- # Replace this with your real tests.
- def test_truth
- assert true
- end
-end
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/unit/stone_test.rb b/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/unit/stone_test.rb
deleted file mode 100644
index 76b518d7..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/integration/app/test/unit/stone_test.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-require File.dirname(__FILE__) + '/../test_helper'
-
-class StoneTest < Test::Unit::TestCase
- # Replace this with your real tests.
- def test_truth
- assert true
- end
-end
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/integration/server_test.rb b/vendor/gems/has_many_polymorphs-2.13/test/integration/server_test.rb
deleted file mode 100644
index e53ea1aa..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/integration/server_test.rb
+++ /dev/null
@@ -1,43 +0,0 @@
-
-require "#{File.dirname(__FILE__)}/../test_helper"
-require 'open-uri'
-
-# Start the server
-
-class ServerTest < Test::Unit::TestCase
-
- PORT = 43040
- URL = "http://localhost:#{PORT}/"
-
- def setup
- @pid = Process.fork do
- Dir.chdir RAILS_ROOT do
- # print "S"
- exec("script/server -p #{PORT} &> #{LOG}")
- end
- end
- sleep(5)
- end
-
- def teardown
- # Process.kill(9, @pid) doesn't work because Mongrel has double-forked itself away
- `ps awx | grep #{PORT} | grep -v grep | awk '{print $1}'`.split("\n").each do |pid|
- system("kill -9 #{pid}")
- # print "K"
- end
- sleep(2)
- @pid = nil
- end
-
- def test_association_reloading
- assert_match(/Bones: index/, open(URL + 'bones').read)
- assert_match(/Bones: index/, open(URL + 'bones').read)
- assert_match(/Bones: index/, open(URL + 'bones').read)
- assert_match(/Bones: index/, open(URL + 'bones').read)
- end
-
- def test_verify_autoload_gets_invoked_in_console
- # XXX Probably can use script/runner to test this
- end
-
-end
\ No newline at end of file
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/models/aquatic/fish.rb b/vendor/gems/has_many_polymorphs-2.13/test/models/aquatic/fish.rb
deleted file mode 100644
index 204642e9..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/models/aquatic/fish.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class Aquatic::Fish < ActiveRecord::Base
- # set_table_name "fish"
- # attr_accessor :after_find_test, :after_initialize_test
-end
-
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/models/aquatic/pupils_whale.rb b/vendor/gems/has_many_polymorphs-2.13/test/models/aquatic/pupils_whale.rb
deleted file mode 100644
index ae4cbc18..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/models/aquatic/pupils_whale.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-
-class Aquatic::PupilsWhale < ActiveRecord::Base
- set_table_name "little_whale_pupils"
- belongs_to :whale, :class_name => "Aquatic::Whale", :foreign_key => "whale_id"
- belongs_to :aquatic_pupil, :polymorphic => true
-end
-
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/models/aquatic/whale.rb b/vendor/gems/has_many_polymorphs-2.13/test/models/aquatic/whale.rb
deleted file mode 100644
index 0ca1b7fb..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/models/aquatic/whale.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# see http://dev.rubyonrails.org/ticket/5935
-module Aquatic; end
-require 'aquatic/fish'
-require 'aquatic/pupils_whale'
-
-class Aquatic::Whale < ActiveRecord::Base
- # set_table_name "whales"
-
- has_many_polymorphs(:aquatic_pupils, :from => [:dogs, :"aquatic/fish"],
- :through => "aquatic/pupils_whales") do
- def a_method
- :correct_block_result
- end
- end
-end
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/models/beautiful_fight_relationship.rb b/vendor/gems/has_many_polymorphs-2.13/test/models/beautiful_fight_relationship.rb
deleted file mode 100644
index b678c982..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/models/beautiful_fight_relationship.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-
-require 'extension_module'
-
-class BeautifulFightRelationship < ActiveRecord::Base
- set_table_name 'keep_your_enemies_close'
-
- belongs_to :enemy, :polymorphic => true
- belongs_to :protector, :polymorphic => true
- # polymorphic relationships with column names different from the relationship name
- # are not supported by Rails
-
- acts_as_double_polymorphic_join :enemies => [:dogs, :kittens, :frogs],
- :protectors => [:wild_boars, :kittens, :"aquatic/fish", :dogs],
- :enemies_extend => [ExtensionModule, proc {}],
- :protectors_extend => proc {
- def a_method
- :correct_proc_result
- end
- },
- :join_extend => proc {
- def a_method
- :correct_join_result
- end
- }
-end
-
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/models/canine.rb b/vendor/gems/has_many_polymorphs-2.13/test/models/canine.rb
deleted file mode 100644
index b0010160..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/models/canine.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-class Canine < ActiveRecord::Base
- self.abstract_class = true
-
- def an_abstract_method
- :correct_abstract_method_response
- end
-
-end
-
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/models/cat.rb b/vendor/gems/has_many_polymorphs-2.13/test/models/cat.rb
deleted file mode 100644
index 0c99ff08..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/models/cat.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class Cat < ActiveRecord::Base
- # STI base class
- self.inheritance_column = 'cat_type'
-end
-
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/models/dog.rb b/vendor/gems/has_many_polymorphs-2.13/test/models/dog.rb
deleted file mode 100644
index 7f027237..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/models/dog.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-
-require 'canine'
-
-class Dog < Canine
- attr_accessor :after_find_test, :after_initialize_test
- set_table_name "bow_wows"
-
- def after_find
- @after_find_test = true
-# puts "After find called on #{name}."
- end
-
- def after_initialize
- @after_initialize_test = true
- end
-
-end
-
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/models/eaters_foodstuff.rb b/vendor/gems/has_many_polymorphs-2.13/test/models/eaters_foodstuff.rb
deleted file mode 100644
index d904bb16..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/models/eaters_foodstuff.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-
-class EatersFoodstuff < ActiveRecord::Base
- belongs_to :foodstuff, :class_name => "Petfood", :foreign_key => "foodstuff_id"
- belongs_to :eater, :polymorphic => true
-
- def before_save
- self.some_attribute = 3
- end
-end
-
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/models/frog.rb b/vendor/gems/has_many_polymorphs-2.13/test/models/frog.rb
deleted file mode 100644
index 5a0f4658..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/models/frog.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-class Frog < ActiveRecord::Base
-
-end
-
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/models/kitten.rb b/vendor/gems/has_many_polymorphs-2.13/test/models/kitten.rb
deleted file mode 100644
index 2a244c03..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/models/kitten.rb
+++ /dev/null
@@ -1,3 +0,0 @@
-class Kitten < Cat
-# has_many :eaters_parents, :dependent => true, :as => 'eater'
-end
\ No newline at end of file
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/models/parentship.rb b/vendor/gems/has_many_polymorphs-2.13/test/models/parentship.rb
deleted file mode 100644
index e87b759b..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/models/parentship.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-class Parentship < ActiveRecord::Base
- belongs_to :parent, :class_name => "Person", :foreign_key => "parent_id"
- belongs_to :kid, :polymorphic => true, :foreign_type => "child_type"
-end
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/models/person.rb b/vendor/gems/has_many_polymorphs-2.13/test/models/person.rb
deleted file mode 100644
index 5d019829..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/models/person.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-require 'parentship'
-class Person < ActiveRecord::Base
- has_many_polymorphs :kids,
- :through => :parentships,
- :from => [:people],
- :as => :parent,
- :polymorphic_type_key => "child_type",
- :conditions => "people.age < 10"
-end
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/models/petfood.rb b/vendor/gems/has_many_polymorphs-2.13/test/models/petfood.rb
deleted file mode 100644
index df420ea8..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/models/petfood.rb
+++ /dev/null
@@ -1,39 +0,0 @@
-# see http://dev.rubyonrails.org/ticket/5935
-require 'eaters_foodstuff'
-require 'petfood'
-require 'cat'
-module Aquatic; end
-require 'aquatic/fish'
-require 'dog'
-require 'wild_boar'
-require 'kitten'
-require 'tabby'
-require 'extension_module'
-require 'other_extension_module'
-
-class Petfood < ActiveRecord::Base
- set_primary_key 'the_petfood_primary_key'
- has_many_polymorphs :eaters,
- :from => [:dogs, :petfoods, :wild_boars, :kittens,
- :tabbies, :"aquatic/fish"],
-# :dependent => :destroy, :destroy is now the default
- :rename_individual_collections => true,
- :as => :foodstuff,
- :foreign_key => "foodstuff_id",
- :ignore_duplicates => false,
- :conditions => "NULL IS NULL",
- :order => "eaters_foodstuffs.updated_at ASC",
- :parent_order => "petfoods.the_petfood_primary_key DESC",
- :parent_conditions => "petfoods.name IS NULL OR petfoods.name != 'Snausages'",
- :extend => [ExtensionModule, OtherExtensionModule, proc {}],
- :join_extend => proc {
- def a_method
- :correct_join_result
- end
- },
- :parent_extend => proc {
- def a_method
- :correct_parent_proc_result
- end
- }
- end
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/models/tabby.rb b/vendor/gems/has_many_polymorphs-2.13/test/models/tabby.rb
deleted file mode 100644
index 3cd0f994..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/models/tabby.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-class Tabby < Cat
-end
\ No newline at end of file
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/models/wild_boar.rb b/vendor/gems/has_many_polymorphs-2.13/test/models/wild_boar.rb
deleted file mode 100644
index 27d36a53..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/models/wild_boar.rb
+++ /dev/null
@@ -1,3 +0,0 @@
-class WildBoar < ActiveRecord::Base
-end
-
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/modules/extension_module.rb b/vendor/gems/has_many_polymorphs-2.13/test/modules/extension_module.rb
deleted file mode 100644
index 7cb4eff4..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/modules/extension_module.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-
-module ExtensionModule
- def a_method
- :correct_module_result
- end
- def self.a_method
- :incorrect_module_result
- end
-end
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/modules/other_extension_module.rb b/vendor/gems/has_many_polymorphs-2.13/test/modules/other_extension_module.rb
deleted file mode 100644
index 16313bd8..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/modules/other_extension_module.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-
-module OtherExtensionModule
- def another_method
- :correct_other_module_result
- end
- def self.another_method
- :incorrect_other_module_result
- end
-end
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/patches/symlinked_plugins_1.2.6.diff b/vendor/gems/has_many_polymorphs-2.13/test/patches/symlinked_plugins_1.2.6.diff
deleted file mode 100644
index 99e0df3e..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/patches/symlinked_plugins_1.2.6.diff
+++ /dev/null
@@ -1,46 +0,0 @@
-Index: /trunk/railties/lib/rails_generator/lookup.rb
-===================================================================
---- /trunk/railties/lib/rails_generator/lookup.rb (revision 4310)
-+++ /trunk/railties/lib/rails_generator/lookup.rb (revision 6101)
-@@ -101,5 +101,5 @@
- sources << PathSource.new(:lib, "#{::RAILS_ROOT}/lib/generators")
- sources << PathSource.new(:vendor, "#{::RAILS_ROOT}/vendor/generators")
-- sources << PathSource.new(:plugins, "#{::RAILS_ROOT}/vendor/plugins/**/generators")
-+ sources << PathSource.new(:plugins, "#{::RAILS_ROOT}/vendor/plugins/*/**/generators")
- end
- sources << PathSource.new(:user, "#{Dir.user_home}/.rails/generators")
-Index: /trunk/railties/lib/tasks/rails.rb
-===================================================================
---- /trunk/railties/lib/tasks/rails.rb (revision 5469)
-+++ /trunk/railties/lib/tasks/rails.rb (revision 6101)
-@@ -6,3 +6,3 @@
- # Load any custom rakefile extensions
- Dir["#{RAILS_ROOT}/lib/tasks/**/*.rake"].sort.each { |ext| load ext }
--Dir["#{RAILS_ROOT}/vendor/plugins/**/tasks/**/*.rake"].sort.each { |ext| load ext }
-+Dir["#{RAILS_ROOT}/vendor/plugins/*/**/tasks/**/*.rake"].sort.each { |ext| load ext }
-Index: /trunk/railties/lib/tasks/testing.rake
-===================================================================
---- /trunk/railties/lib/tasks/testing.rake (revision 5263)
-+++ /trunk/railties/lib/tasks/testing.rake (revision 6101)
-@@ -109,9 +109,9 @@
- t.pattern = "vendor/plugins/#{ENV['PLUGIN']}/test/**/*_test.rb"
- else
-- t.pattern = 'vendor/plugins/**/test/**/*_test.rb'
-+ t.pattern = 'vendor/plugins/*/**/test/**/*_test.rb'
- end
-
- t.verbose = true
- end
-- Rake::Task['test:plugins'].comment = "Run the plugin tests in vendor/plugins/**/test (or specify with PLUGIN=name)"
-+ Rake::Task['test:plugins'].comment = "Run the plugin tests in vendor/plugins/*/**/test (or specify with PLUGIN=name)"
- end
-Index: /trunk/railties/CHANGELOG
-===================================================================
---- /trunk/railties/CHANGELOG (revision 6069)
-+++ /trunk/railties/CHANGELOG (revision 6101)
-@@ -1,3 +1,5 @@
- *SVN*
-+
-+* Plugins may be symlinked in vendor/plugins. #4245 [brandon, progrium@gmail.com]
-
- * Resource generator depends on the model generator rather than duplicating it. #7269 [bscofield]
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/schema.rb b/vendor/gems/has_many_polymorphs-2.13/test/schema.rb
deleted file mode 100644
index 39d869dc..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/schema.rb
+++ /dev/null
@@ -1,87 +0,0 @@
-ActiveRecord::Schema.define(:version => 0) do
- create_table :petfoods, :force => true, :primary_key => :the_petfood_primary_key do |t|
- t.column :name, :string
- t.column :created_at, :datetime, :null => false
- t.column :updated_at, :datetime, :null => false
- end
-
- create_table :bow_wows, :force => true do |t|
- t.column :name, :string
- t.column :created_at, :datetime, :null => false
- t.column :updated_at, :datetime, :null => false
- end
-
- create_table :cats, :force => true do |t|
- t.column :name, :string
- t.column :cat_type, :string
- t.column :created_at, :datetime, :null => false
- t.column :updated_at, :datetime, :null => false
- end
-
- create_table :frogs, :force => true do |t|
- t.column :name, :string
- t.column :created_at, :datetime, :null => false
- t.column :updated_at, :datetime, :null => false
- end
-
- create_table :wild_boars, :force => true do |t|
- t.column :name, :string
- t.column :created_at, :datetime, :null => false
- t.column :updated_at, :datetime, :null => false
- end
-
- create_table :eaters_foodstuffs, :force => true do |t|
- t.column :foodstuff_id, :integer
- t.column :eater_id, :integer
- t.column :some_attribute, :integer, :default => 0
- t.column :eater_type, :string
- t.column :created_at, :datetime, :null => false
- t.column :updated_at, :datetime, :null => false
- end
-
- create_table :fish, :force => true do |t|
- t.column :name, :string
- t.column :speed, :integer
- t.column :created_at, :datetime, :null => false
- t.column :updated_at, :datetime, :null => false
- end
-
- create_table :whales, :force => true do |t|
- t.column :name, :string
- t.column :created_at, :datetime, :null => false
- t.column :updated_at, :datetime, :null => false
- end
-
- create_table :little_whale_pupils, :force => true do |t|
- t.column :whale_id, :integer
- t.column :aquatic_pupil_id, :integer
- t.column :aquatic_pupil_type, :string
- t.column :created_at, :datetime, :null => false
- t.column :updated_at, :datetime, :null => false
- end
-
- create_table :keep_your_enemies_close, :force => true do |t|
- t.column :enemy_id, :integer
- t.column :enemy_type, :string
- t.column :protector_id, :integer
- t.column :protector_type, :string
- t.column :created_at, :datetime, :null => false
- t.column :updated_at, :datetime, :null => false
- end
-
- create_table :parentships, :force => true do |t|
- t.column :parent_id, :integer
- t.column :child_type, :string
- t.column :kid_id, :integer
- t.column :created_at, :datetime, :null => false
- t.column :updated_at, :datetime, :null => false
- end
-
- create_table :people, :force => true do |t|
- t.column :name, :string
- t.column :age, :integer
- t.column :created_at, :datetime, :null => false
- t.column :updated_at, :datetime, :null => false
- end
-
-end
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/setup.rb b/vendor/gems/has_many_polymorphs-2.13/test/setup.rb
deleted file mode 100644
index 52535798..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/setup.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-
-# Setup integration system for the integration suite
-
-Dir.chdir "#{File.dirname(__FILE__)}/integration/app/" do
- Dir.chdir "vendor/plugins" do
- system("rm has_many_polymorphs; ln -s ../../../../../ has_many_polymorphs")
- end
-
- system "rake db:drop --trace RAILS_GEM_VERSION=2.2.2 "
- system "rake db:create --trace RAILS_GEM_VERSION=2.2.2 "
- system "rake db:migrate --trace"
- system "rake db:fixtures:load --trace"
-end
-
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/test_helper.rb b/vendor/gems/has_many_polymorphs-2.13/test/test_helper.rb
deleted file mode 100644
index 363a6607..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/test_helper.rb
+++ /dev/null
@@ -1,51 +0,0 @@
-
-$VERBOSE = nil
-require 'rubygems'
-require 'echoe'
-require 'test/unit'
-require 'multi_rails_init'
-require 'ruby-debug'
-
-if defined? ENV['MULTIRAILS_RAILS_VERSION']
- ENV['RAILS_GEM_VERSION'] = ENV['MULTIRAILS_RAILS_VERSION']
-end
-
-Echoe.silence do
- HERE = File.expand_path(File.dirname(__FILE__))
- $LOAD_PATH << HERE
- # $LOAD_PATH << "#{HERE}/integration/app"
-end
-
-LOG = "#{HERE}/integration/app/log/development.log"
-
-### For unit tests
-
-require 'integration/app/config/environment'
-require 'test_help'
-
-ActiveSupport::Inflector.inflections {|i| i.irregular 'fish', 'fish' }
-
-$LOAD_PATH.unshift(Test::Unit::TestCase.fixture_path = HERE + "/fixtures")
-$LOAD_PATH.unshift(HERE + "/models")
-$LOAD_PATH.unshift(HERE + "/modules")
-
-class Test::Unit::TestCase
- self.use_transactional_fixtures = !(ActiveRecord::Base.connection.is_a? ActiveRecord::ConnectionAdapters::MysqlAdapter rescue false)
- self.use_instantiated_fixtures = false
-end
-
-Echoe.silence do
- load(HERE + "/schema.rb")
-end
-
-### For integration tests
-
-def truncate
- system("> #{LOG}")
-end
-
-def log
- File.open(LOG, 'r') do |f|
- f.read
- end
-end
diff --git a/vendor/gems/has_many_polymorphs-2.13/test/unit/has_many_polymorphs_test.rb b/vendor/gems/has_many_polymorphs-2.13/test/unit/has_many_polymorphs_test.rb
deleted file mode 100644
index 7f4b05a4..00000000
--- a/vendor/gems/has_many_polymorphs-2.13/test/unit/has_many_polymorphs_test.rb
+++ /dev/null
@@ -1,714 +0,0 @@
-require File.dirname(__FILE__) + '/../test_helper'
-
-require 'dog'
-require 'wild_boar'
-require 'frog'
-require 'cat'
-require 'kitten'
-require 'aquatic/whale'
-require 'aquatic/fish'
-require 'aquatic/pupils_whale'
-require 'beautiful_fight_relationship'
-
-class PolymorphTest < Test::Unit::TestCase
-
- set_fixture_class :bow_wows => Dog
- set_fixture_class :keep_your_enemies_close => BeautifulFightRelationship
- set_fixture_class :whales => Aquatic::Whale
- set_fixture_class :fish => Aquatic::Fish
- set_fixture_class :little_whale_pupils => Aquatic::PupilsWhale
-
- fixtures :cats, :bow_wows, :frogs, :wild_boars, :eaters_foodstuffs, :petfoods,
- :fish, :whales, :little_whale_pupils, :keep_your_enemies_close, :people
-
- def setup
- @association_error = ActiveRecord::Associations::PolymorphicError
- @kibbles = Petfood.find(1)
- @bits = Petfood.find(2)
- @shamu = Aquatic::Whale.find(1)
- @swimmy = Aquatic::Fish.find(1)
- @rover = Dog.find(1)
- @spot = Dog.find(2)
- @puma = WildBoar.find(1)
- @chloe = Kitten.find(1)
- @alice = Kitten.find(2)
- @toby = Tabby.find(3)
- @froggy = Frog.find(1)
-
- @join_count = EatersFoodstuff.count
- @kibbles_eaters_count = @kibbles.eaters.size
- @bits_eaters_count = @bits.eaters.size
-
- @double_join_count = BeautifulFightRelationship.count
- @alice_enemies_count = @alice.enemies.size
- end
-
- def test_all_relationship_validities
- # q = []
- # ObjectSpace.each_object(Class){|c| q << c if c.ancestors.include? ActiveRecord::Base }
- # q.each{|c| puts "#{c.name}.reflect_on_all_associations.map(&:check_validity!)"}
- Petfood.reflect_on_all_associations.map(&:check_validity!)
- Tabby.reflect_on_all_associations.map(&:check_validity!)
- Kitten.reflect_on_all_associations.map(&:check_validity!)
- Dog.reflect_on_all_associations.map(&:check_validity!)
- Canine.reflect_on_all_associations.map(&:check_validity!)
- Aquatic::Fish.reflect_on_all_associations.map(&:check_validity!)
- EatersFoodstuff.reflect_on_all_associations.map(&:check_validity!)
- WildBoar.reflect_on_all_associations.map(&:check_validity!)
- Frog.reflect_on_all_associations.map(&:check_validity!)
- Cat.reflect_on_all_associations.map(&:check_validity!)
- BeautifulFightRelationship.reflect_on_all_associations.map(&:check_validity!)
- Person.reflect_on_all_associations.map(&:check_validity!)
- Parentship.reflect_on_all_associations.map(&:check_validity!)
- Aquatic::Whale.reflect_on_all_associations.map(&:check_validity!)
- Aquatic::PupilsWhale.reflect_on_all_associations.map(&:check_validity!)
- end
-
- def test_assignment
- assert @kibbles.eaters.blank?
- assert @kibbles.eaters.push(Cat.find_by_name('Chloe'))
- assert_equal @kibbles_eaters_count += 1, @kibbles.eaters.count
-
- @kibbles.reload
- assert_equal @kibbles_eaters_count, @kibbles.eaters.count
- end
-
- def test_duplicate_assignment
- # try to add a duplicate item when :ignore_duplicates is false
- @kibbles.eaters.push(@alice)
- assert @kibbles.eaters.include?(@alice)
- @kibbles.eaters.push(@alice)
- assert_equal @kibbles_eaters_count + 2, @kibbles.eaters.count
- assert_equal @join_count + 2, EatersFoodstuff.count
- end
-
- def test_create_and_push
- assert @kibbles.eaters.push(@spot)
- assert_equal @kibbles_eaters_count += 1, @kibbles.eaters.count
- assert @kibbles.eaters << @rover
- assert @kibbles.eaters << Kitten.create(:name => "Miranda")
- assert_equal @kibbles_eaters_count += 2, @kibbles.eaters.length
-
- @kibbles.reload
- assert_equal @kibbles_eaters_count, @kibbles.eaters.length
-
- # test that ids and new flags were set appropriately
- assert_not_nil @kibbles.eaters[0].id
- assert !@kibbles.eaters[1].new_record?
- end
-
- def test_reload
- assert @kibbles.reload
- assert @kibbles.eaters.reload
- end
-
- def test_add_join_record
- assert_equal Kitten, @chloe.class
- assert join = EatersFoodstuff.new(:foodstuff_id => @bits.id, :eater_id => @chloe.id, :eater_type => @chloe.class.name )
- assert join.save!
- assert join.id
- assert_equal @join_count + 1, EatersFoodstuff.count
-
- #assert_equal @bits_eaters_count, @bits.eaters.size # Doesn't behave this way on latest edge anymore
- assert_equal @bits_eaters_count + 1, @bits.eaters.count # SQL
-
- # reload; is the new association there?
- assert @bits.eaters.reload
- assert @bits.eaters.include?(@chloe)
- end
-
- def test_build_join_record_on_association
- assert_equal Kitten, @chloe.class
- assert join = @chloe.eaters_foodstuffs.build(:foodstuff => @bits)
- # assert_equal join.eater_type, @chloe.class.name # will be STI parent type
- assert join.save!
- assert join.id
- assert_equal @join_count + 1, EatersFoodstuff.count
-
- assert @bits.eaters.reload
- assert @bits.eaters.include?(@chloe)
- end
-
-# not supporting this, since has_many :through doesn't support it either
-# def test_add_unsaved
-# # add an unsaved item
-# assert @bits.eaters << Kitten.new(:name => "Bridget")
-# assert_nil Kitten.find_by_name("Bridget")
-# assert_equal @bits_eaters_count + 1, @bits.eaters.count
-#
-# assert @bits.save
-# @bits.reload
-# assert_equal @bits_eaters_count + 1, @bits.eaters.count
-#
-# end
-
- def test_self_reference
- assert @kibbles.eaters << @bits
- assert_equal @kibbles_eaters_count += 1, @kibbles.eaters.count
- assert @kibbles.eaters.include?(@bits)
- @kibbles.reload
- assert @kibbles.foodstuffs_of_eaters.blank?
-
- @bits.reload
- assert @bits.foodstuffs_of_eaters.include?(@kibbles)
- assert_equal [@kibbles], @bits.foodstuffs_of_eaters
- end
-
- def test_remove
- assert @kibbles.eaters << @chloe
- @kibbles.reload
- assert @kibbles.eaters.delete(@kibbles.eaters[0])
- assert_equal @kibbles_eaters_count, @kibbles.eaters.count
- end
-
- def test_destroy
- assert @kibbles.eaters.push(@chloe)
- @kibbles.reload
- assert @kibbles.eaters.length > 0
- assert @kibbles.eaters[0].destroy
- @kibbles.reload
- assert_equal @kibbles_eaters_count, @kibbles.eaters.count
- end
-
- def test_clear
- @kibbles.eaters << [@chloe, @spot, @rover]
- @kibbles.reload
- assert @kibbles.eaters.clear.blank?
- assert @kibbles.eaters.blank?
- @kibbles.reload
- assert @kibbles.eaters.blank?
- end
-
- def test_individual_collections
- assert @kibbles.eaters.push(@chloe)
- # check if individual collections work
- assert_equal @kibbles.eater_kittens.length, 1
- assert @kibbles.eater_dogs
- assert 1, @rover.eaters_foodstuffs.count
- end
-
- def test_individual_collections_push
- assert_equal [@chloe], (@kibbles.eater_kittens << @chloe)
- @kibbles.reload
- assert @kibbles.eaters.include?(@chloe)
- assert @kibbles.eater_kittens.include?(@chloe)
- assert !@kibbles.eater_dogs.include?(@chloe)
- end
-
- def test_individual_collections_delete
- @kibbles.eaters << [@chloe, @spot, @rover]
- @kibbles.reload
- assert_equal [@chloe], @kibbles.eater_kittens.delete(@chloe)
- assert @kibbles.eater_kittens.empty?
- @kibbles.eater_kittens.delete(@chloe) # what should this return?
-
- @kibbles.reload
- assert @kibbles.eater_kittens.empty?
- assert @kibbles.eater_dogs.include?(@spot)
- end
-
- def test_individual_collections_clear
- @kibbles.eaters << [@chloe, @spot, @rover]
- @kibbles.reload
-
- assert_equal [], @kibbles.eater_kittens.clear
- assert @kibbles.eater_kittens.empty?
- assert_equal 2, @kibbles.eaters.size
-
- assert @kibbles.eater_kittens.empty?
- assert_equal 2, @kibbles.eaters.size
- assert !@kibbles.eater_kittens.include?(@chloe)
- assert !@kibbles.eaters.include?(@chloe)
-
- @kibbles.reload
- assert @kibbles.eater_kittens.empty?
- assert_equal 2, @kibbles.eaters.size
- assert !@kibbles.eater_kittens.include?(@chloe)
- assert !@kibbles.eaters.include?(@chloe)
- end
-
- def test_childrens_individual_collections
- assert Cat.find_by_name('Chloe').eaters_foodstuffs
- assert @kibbles.eaters_foodstuffs
- end
-
- def test_self_referential_join_tables
- # check that the self-reference join tables go the right ways
- assert_equal @kibbles_eaters_count, @kibbles.eaters_foodstuffs.count
- assert_equal @kibbles.eaters_foodstuffs.count, @kibbles.eaters_foodstuffs_as_child.count
- end
-
- def test_dependent
- assert @kibbles.eaters << @chloe
- @kibbles.reload
-
- # delete ourself and see if :dependent was obeyed
- dependent_rows = @kibbles.eaters_foodstuffs
- assert_equal dependent_rows.length, @kibbles.eaters.count
- @join_count = EatersFoodstuff.count
-
- @kibbles.destroy
- assert_equal @join_count - dependent_rows.length, EatersFoodstuff.count
- assert_equal 0, EatersFoodstuff.find(:all, :conditions => ['foodstuff_id = ?', 1] ).length
- end
-
- def test_normal_callbacks
- assert @rover.respond_to?(:after_initialize)
- assert @rover.respond_to?(:after_find)
- assert @rover.after_initialize_test
- assert @rover.after_find_test
- end
-
- def test_model_callbacks_not_overridden_by_plugin_callbacks
- assert 0, @bits.eaters.count
- assert @bits.eaters.push(@rover)
- @bits.save
- @bits2 = Petfood.find_by_name("Bits")
- @bits.reload
- assert rover = @bits2.eaters.select { |x| x.name == "Rover" }[0]
- assert rover.after_initialize_test
- assert rover.after_find_test
- end
-
- def test_number_of_join_records
- assert EatersFoodstuff.create(:foodstuff_id => 1, :eater_id => 1, :eater_type => "Cat")
- @join_count = EatersFoodstuff.count
- assert @join_count > 0
- end
-
- def test_number_of_regular_records
- dogs = Dog.count
- assert Dog.new(:name => "Auggie").save!
- assert dogs + 1, Dog.count
- end
-
- def test_attributes_come_through_when_child_has_underscore_in_table_name
- join = EatersFoodstuff.new(:foodstuff_id => @bits.id, :eater_id => @puma.id, :eater_type => @puma.class.name)
- join.save!
-
- @bits.eaters.reload
-
- assert_equal "Puma", @puma.name
- assert_equal "Puma", @bits.eaters.first.name
- end
-
-
- def test_before_save_on_join_table_is_not_clobbered_by_sti_base_class_fix
- assert @kibbles.eaters << @chloe
- assert_equal 3, @kibbles.eaters_foodstuffs.first.some_attribute
- end
-
- def test_sti_type_counts_are_correct
- @kibbles.eaters << [@chloe, @alice, @toby]
- assert_equal 2, @kibbles.eater_kittens.count
- assert_equal 1, @kibbles.eater_tabbies.count
- assert !@kibbles.respond_to?(:eater_cats)
- end
-
-
- def test_creating_namespaced_relationship
- assert @shamu.aquatic_pupils.empty?
- @shamu.aquatic_pupils << @swimmy
- assert_equal 1, @shamu.aquatic_pupils.length
- @shamu.reload
- assert_equal 1, @shamu.aquatic_pupils.length
- end
-
- def test_namespaced_polymorphic_collection
- @shamu.aquatic_pupils << @swimmy
- assert @shamu.aquatic_pupils.include?(@swimmy)
- @shamu.reload
- assert @shamu.aquatic_pupils.include?(@swimmy)
-
- @shamu.aquatic_pupils << @spot
- assert @shamu.dogs.include?(@spot)
- assert @shamu.aquatic_pupils.include?(@swimmy)
- assert_equal @swimmy, @shamu.aquatic_fish.first
- assert_equal 10, @shamu.aquatic_fish.first.speed
- end
-
- def test_deleting_namespaced_relationship
- @shamu.aquatic_pupils << @swimmy
- @shamu.aquatic_pupils << @spot
-
- @shamu.reload
- @shamu.aquatic_pupils.delete @spot
- assert !@shamu.dogs.include?(@spot)
- assert !@shamu.aquatic_pupils.include?(@spot)
- assert_equal 1, @shamu.aquatic_pupils.length
- end
-
- def test_unrenamed_parent_of_namespaced_child
- @shamu.aquatic_pupils << @swimmy
- assert_equal [@shamu], @swimmy.whales
- end
-
- def test_empty_double_collections
- assert @puma.enemies.empty?
- assert @froggy.protectors.empty?
- assert @alice.enemies.empty?
- assert @spot.protectors.empty?
- assert @alice.beautiful_fight_relationships_as_enemy.empty?
- assert @alice.beautiful_fight_relationships_as_protector.empty?
- assert @alice.beautiful_fight_relationships.empty?
- end
-
- def test_double_collection_assignment
- @alice.enemies << @spot
- @alice.reload
- @spot.reload
- assert @spot.protectors.include?(@alice)
- assert @alice.enemies.include?(@spot)
- assert !@alice.protectors.include?(@alice)
- assert_equal 1, @alice.beautiful_fight_relationships_as_protector.size
- assert_equal 0, @alice.beautiful_fight_relationships_as_enemy.size
- assert_equal 1, @alice.beautiful_fight_relationships.size
-
- # self reference
- assert_equal 1, @alice.enemies.length
- @alice.enemies.push @alice
- assert @alice.enemies.include?(@alice)
- assert_equal 2, @alice.enemies.length
- @alice.reload
- assert_equal 2, @alice.beautiful_fight_relationships_as_protector.size
- assert_equal 1, @alice.beautiful_fight_relationships_as_enemy.size
- assert_equal 3, @alice.beautiful_fight_relationships.size
- end
-
- def test_double_collection_build_join_record_on_association
-
- join = @alice.beautiful_fight_relationships_as_protector.build(:enemy => @spot)
-
- assert_equal @alice.class.base_class.name, join.protector_type
- assert_nothing_raised { join.save! }
-
- assert join.id
- assert_equal @double_join_count + 1, BeautifulFightRelationship.count
-
- assert @alice.enemies.reload
- assert @alice.enemies.include?(@spot)
- end
-
- def test_double_dependency_injection
-# breakpoint
- end
-
- def test_double_collection_deletion
- @alice.enemies << @spot
- @alice.reload
- assert @alice.enemies.include?(@spot)
- @alice.enemies.delete(@spot)
- assert !@alice.enemies.include?(@spot)
- assert @alice.enemies.empty?
- @alice.reload
- assert !@alice.enemies.include?(@spot)
- assert @alice.enemies.empty?
- assert_equal 0, @alice.beautiful_fight_relationships.size
- end
-
- def test_double_collection_deletion_from_opposite_side
- @alice.protectors << @puma
- @alice.reload
- assert @alice.protectors.include?(@puma)
- @alice.protectors.delete(@puma)
- assert !@alice.protectors.include?(@puma)
- assert @alice.protectors.empty?
- @alice.reload
- assert !@alice.protectors.include?(@puma)
- assert @alice.protectors.empty?
- assert_equal 0, @alice.beautiful_fight_relationships.size
- end
-
- def test_individual_collections_created_for_double_relationship
- assert @alice.dogs.empty?
- @alice.enemies << @spot
-
- assert @alice.enemies.include?(@spot)
- assert !@alice.kittens.include?(@alice)
-
- assert !@alice.dogs.include?(@spot)
- @alice.reload
- assert @alice.dogs.include?(@spot)
- assert !WildBoar.find(@alice.id).dogs.include?(@spot) # make sure the parent type is checked
- end
-
- def test_individual_collections_created_for_double_relationship_from_opposite_side
- assert @alice.wild_boars.empty?
- @alice.protectors << @puma
-
- assert @alice.protectors.include?(@puma)
- assert !@alice.wild_boars.include?(@puma)
- @alice.reload
- assert @alice.wild_boars.include?(@puma)
-
- assert !Dog.find(@alice.id).wild_boars.include?(@puma) # make sure the parent type is checked
- end
-
- def test_self_referential_individual_collections_created_for_double_relationship
- @alice.enemies << @alice
- @alice.reload
- assert @alice.enemy_kittens.include?(@alice)
- assert @alice.protector_kittens.include?(@alice)
- assert @alice.kittens.include?(@alice)
- assert_equal 2, @alice.kittens.size
-
- @alice.enemies << (@chloe = Kitten.find_by_name('Chloe'))
- @alice.reload
- assert @alice.enemy_kittens.include?(@chloe)
- assert !@alice.protector_kittens.include?(@chloe)
- assert @alice.kittens.include?(@chloe)
- assert_equal 3, @alice.kittens.size
- end
-
- def test_child_of_polymorphic_join_can_reach_parent
- @alice.enemies << @spot
- @alice.reload
- assert @spot.protectors.include?(@alice)
- end
-
- def test_double_collection_deletion_from_child_polymorphic_join
- @alice.enemies << @spot
- @spot.protectors.delete(@alice)
- assert !@spot.protectors.include?(@alice)
- @alice.reload
- assert !@alice.enemies.include?(@spot)
- BeautifulFightRelationship.create(:protector_id => 2, :protector_type => "Dog", :enemy_id => @spot.id, :enemy_type => @spot.class.name)
- @alice.enemies << @spot
- @spot.protectors.delete(@alice)
- assert !@spot.protectors.include?(@alice)
- end
-
- def test_collection_query_on_unsaved_record
- assert Dog.new.enemies.empty?
- assert Dog.new.foodstuffs_of_eaters.empty?
- end
-
- def test_double_individual_collections_push
- assert_equal [@chloe], (@spot.protector_kittens << @chloe)
- @spot.reload
- assert @spot.protectors.include?(@chloe)
- assert @spot.protector_kittens.include?(@chloe)
- assert !@spot.protector_dogs.include?(@chloe)
-
- assert_equal [@froggy], (@spot.frogs << @froggy)
- @spot.reload
- assert @spot.enemies.include?(@froggy)
- assert @spot.frogs.include?(@froggy)
- assert !@spot.enemy_dogs.include?(@froggy)
- end
-
- def test_double_individual_collections_delete
- @spot.protectors << [@chloe, @puma]
- @spot.reload
- assert_equal [@chloe], @spot.protector_kittens.delete(@chloe)
- assert @spot.protector_kittens.empty?
- @spot.protector_kittens.delete(@chloe) # again, unclear what .delete should return
-
- @spot.reload
- assert @spot.protector_kittens.empty?
- assert @spot.wild_boars.include?(@puma)
- end
-
- def test_double_individual_collections_clear
- @spot.protectors << [@chloe, @puma, @alice]
- @spot.reload
- assert_equal [], @spot.protector_kittens.clear
- assert @spot.protector_kittens.empty?
- assert_equal 1, @spot.protectors.size
- @spot.reload
- assert @spot.protector_kittens.empty?
- assert_equal 1, @spot.protectors.size
- assert !@spot.protector_kittens.include?(@chloe)
- assert !@spot.protectors.include?(@chloe)
- assert !@spot.protector_kittens.include?(@alice)
- assert !@spot.protectors.include?(@alice)
- assert @spot.protectors.include?(@puma)
- assert @spot.wild_boars.include?(@puma)
- end
-
- def test_single_extensions
- assert_equal :correct_block_result, @shamu.aquatic_pupils.a_method
- @kibbles.eaters.push(@alice)
- @kibbles.eaters.push(@spot)
- assert_equal :correct_join_result, @kibbles.eaters_foodstuffs.a_method
- assert_equal :correct_module_result, @kibbles.eaters.a_method
- assert_equal :correct_other_module_result, @kibbles.eaters.another_method
- @kibbles.eaters.each do |eater|
- assert_equal :correct_join_result, eater.eaters_foodstuffs.a_method
- end
- assert_equal :correct_parent_proc_result, @kibbles.foodstuffs_of_eaters.a_method
- assert_equal :correct_parent_proc_result, @kibbles.eaters.first.foodstuffs_of_eaters.a_method
- end
-
- def test_double_extensions
- assert_equal :correct_proc_result, @spot.protectors.a_method
- assert_equal :correct_module_result, @spot.enemies.a_method
- assert_equal :correct_join_result, @spot.beautiful_fight_relationships_as_enemy.a_method
- assert_equal :correct_join_result, @spot.beautiful_fight_relationships_as_protector.a_method
- assert_equal :correct_join_result, @froggy.beautiful_fight_relationships.a_method
- assert_equal :correct_join_result, @froggy.beautiful_fight_relationships_as_enemy.a_method
- assert_raises(NoMethodError) {@froggy.beautiful_fight_relationships_as_protector.a_method}
- end
-
- def test_pluralization_checks
- assert_raises(@association_error) {
- eval "class SomeModel < ActiveRecord::Base
- has_many_polymorphs :polymorphs, :from => [:dog, :cats]
- end" }
- assert_raises(@association_error) {
- eval "class SomeModel < ActiveRecord::Base
- has_many_polymorphs :polymorph, :from => [:dogs, :cats]
- end" }
- assert_raises(@association_error) {
- eval "class SomeModel < ActiveRecord::Base
- acts_as_double_polymorphic_join :polymorph => [:dogs, :cats], :unimorphs => [:dogs, :cats]
- end" }
- end
-
- def test_error_message_on_namespaced_targets
- assert_raises(@association_error) {
- eval "class SomeModel < ActiveRecord::Base
- has_many_polymorphs :polymorphs, :from => [:fish]
- end" }
- end
-
- def test_single_custom_finders
- [@kibbles, @alice, @puma, @spot, @bits].each {|record| @kibbles.eaters << record; sleep 1} # XXX yeah i know
- assert_equal @kibbles.eaters, @kibbles.eaters.find(:all, :order => "eaters_foodstuffs.created_at ASC")
- assert_equal @kibbles.eaters.reverse, @kibbles.eaters.find(:all, :order => "eaters_foodstuffs.created_at DESC")
- if (ActiveRecord::Base.connection.is_a? ActiveRecord::ConnectionAdapters::MysqlAdapter rescue false)
- assert_equal @kibbles.eaters.sort_by(&:created_at), @kibbles.eaters.find(:all, :order => "IFNULL(bow_wows.created_at,(IFNULL(petfoods.created_at,(IFNULL(wild_boars.created_at,(IFNULL(cats.created_at,fish.created_at))))))) ASC")
- end
- assert_equal @kibbles.eaters.select{|x| x.is_a? Petfood}, @kibbles.eater_petfoods.find(:all, :order => "eaters_foodstuffs.created_at ASC")
- end
-
- def test_double_custom_finders
- @spot.protectors << [@chloe, @puma, @alice]
- assert_equal [@chloe], @spot.protectors.find(:all, :conditions => ["cats.name = ?", @chloe.name], :limit => 1)
- assert_equal [], @spot.protectors.find(:all, :conditions => ["cats.name = ?", @chloe.name], :limit => 1, :offset => 1)
- assert_equal 2, @spot.protectors.find(:all, :limit => 100, :offset => 1).size
- end
-
- def test_single_custom_finder_parameters_carry_to_individual_relationships
- # XXX test nullout here
- end
-
- def test_double_custom_finder_parameters_carry_to_individual_relationships
- # XXX test nullout here
- end
-
- def test_include_doesnt_fail
- assert_nothing_raised do
- @spot.protectors.find(:all, :include => :wild_boars)
- end
- end
-
- def test_abstract_method
- assert_equal :correct_abstract_method_response, @spot.an_abstract_method
- end
-
- def test_missing_target_should_raise
- @kibbles.eaters << [@kibbles, @alice, @puma, @spot, @bits]
- @spot.destroy_without_callbacks
- assert_raises(@association_error) { @kibbles.eaters.reload }
-# assert_raises(@association_error) { @kibbles.eater_dogs.reload } # bah AR
- end
-
- def test_lazy_loading_is_lazy
- # XXX
- end
-
- def test_push_with_skip_duplicates_false_doesnt_load_target
- # Loading kibbles locally again because setup calls .size which loads target
- kibbles = Petfood.find(1)
- assert !kibbles.eaters.loaded?
- assert !(kibbles.eater_dogs << Dog.create!(:name => "Mongy")).loaded?
- assert !kibbles.eaters.loaded?
- end
-
- def test_association_foreign_key_is_sane
- assert_equal "eater_id", Petfood.reflect_on_association(:eaters).association_foreign_key
- end
-
- def test_reflection_instance_methods_are_sane
- assert_equal EatersFoodstuff, Petfood.reflect_on_association(:eaters).klass
- assert_equal EatersFoodstuff.name, Petfood.reflect_on_association(:eaters).class_name
- end
-
- def test_parent_order
- @alice.foodstuffs_of_eaters << Petfood.find(:all, :order => "the_petfood_primary_key ASC")
- @alice.reload #not necessary
- assert_equal [2,1], @alice.foodstuffs_of_eaters.map(&:id)
- end
-
- def test_parent_conditions
- @kibbles.eaters << @alice
- assert_equal [@alice], @kibbles.eaters
-
- @snausages = Petfood.create(:name => 'Snausages')
- @snausages.eaters << @alice
- assert_equal [@alice], @snausages.eaters
-
- assert_equal [@kibbles], @alice.foodstuffs_of_eaters
- end
-
- def test_self_referential_hmp_with_conditions
- p = Person.find(:first)
- kid = Person.create(:name => "Tim", :age => 3)
- p.kids << kid
-
- kid.reload; p.reload
-
- # assert_equal [p], kid.parents
- # assert Rails.has_one? Bug
- # non-standard foreign_type key is not set properly when you are the polymorphic interface of a has_many going to a :through
-
- assert_equal [kid], p.kids
- assert_equal [kid], p.people
- end
-
-# def test_polymorphic_include
-# @kibbles.eaters << [@kibbles, @alice, @puma, @spot, @bits]
-# assert @kibbles.eaters.include?(@kibbles.eaters_foodstuffs.find(:all, :include => :eater).first.eater)
-# end
-#
-# def test_double_polymorphic_include
-# end
-#
-# def test_single_child_include
-# end
-#
-# def test_double_child_include
-# end
-#
-# def test_single_include_from_parent
-# end
-#
-# def test_double_include_from_parent
-# end
-#
-# def test_meta_referential_single_include
-# end
-#
-# def test_meta_referential_double_include
-# end
-#
-# def test_meta_referential_single_include
-# end
-#
-# def test_meta_referential_single_double_multi_include
-# end
-#
-# def test_dont_ignore_duplicates
-# end
-#
-# def test_ignore_duplicates
-# end
-#
-# def test_tagging_system_generator
-# end
-#
-# def test_tagging_system_library
-# end
-
-end
diff --git a/vendor/gems/highline-1.5.0/.specification b/vendor/gems/highline-1.5.0/.specification
deleted file mode 100644
index 2ebbb33c..00000000
--- a/vendor/gems/highline-1.5.0/.specification
+++ /dev/null
@@ -1,87 +0,0 @@
---- !ruby/object:Gem::Specification
-name: highline
-version: !ruby/object:Gem::Version
- version: 1.5.0
-platform: ruby
-authors:
-- James Edward Gray II
-autorequire:
-bindir: bin
-cert_chain: []
-
-date: 2008-11-05 00:00:00 +01:00
-default_executable:
-dependencies: []
-
-description: A high-level IO library that provides validation, type conversion, and more for command-line interfaces. HighLine also includes a complete menu system that can crank out anything from simple list selection to complete shells with just minutes of work.
-email: james@grayproductions.net
-executables: []
-
-extensions: []
-
-extra_rdoc_files:
-- README
-- INSTALL
-- TODO
-- CHANGELOG
-- LICENSE
-files:
-- examples/ansi_colors.rb
-- examples/asking_for_arrays.rb
-- examples/basic_usage.rb
-- examples/color_scheme.rb
-- examples/menus.rb
-- examples/overwrite.rb
-- examples/page_and_wrap.rb
-- examples/password.rb
-- examples/trapping_eof.rb
-- examples/using_readline.rb
-- lib/highline/color_scheme.rb
-- lib/highline/import.rb
-- lib/highline/menu.rb
-- lib/highline/question.rb
-- lib/highline/system_extensions.rb
-- lib/highline.rb
-- test/tc_color_scheme.rb
-- test/tc_highline.rb
-- test/tc_import.rb
-- test/tc_menu.rb
-- test/ts_all.rb
-- Rakefile
-- setup.rb
-- README
-- INSTALL
-- TODO
-- CHANGELOG
-- LICENSE
-has_rdoc: true
-homepage: http://highline.rubyforge.org
-post_install_message:
-rdoc_options:
-- --title
-- HighLine Documentation
-- --main
-- README
-require_paths:
-- lib
-required_ruby_version: !ruby/object:Gem::Requirement
- requirements:
- - - ">="
- - !ruby/object:Gem::Version
- version: "0"
- version:
-required_rubygems_version: !ruby/object:Gem::Requirement
- requirements:
- - - ">="
- - !ruby/object:Gem::Version
- version: "0"
- version:
-requirements: []
-
-rubyforge_project: highline
-rubygems_version: 1.3.1
-signing_key:
-specification_version: 2
-summary: HighLine is a high-level command-line IO library.
-test_files:
-- test/ts_all.rb
diff --git a/vendor/gems/highline-1.5.0/CHANGELOG b/vendor/gems/highline-1.5.0/CHANGELOG
deleted file mode 100644
index 3d04911e..00000000
--- a/vendor/gems/highline-1.5.0/CHANGELOG
+++ /dev/null
@@ -1,211 +0,0 @@
-= Change Log
-
-Below is a complete listing of changes for each revision of HighLine.
-
-== 1.5.0
-
-* Fixed a bug that would prevent Readline from showing all completions.
- (reported by Yaohan Chen)
-* Added the ability to pass a block to HighLine#agree().
- (patch by Yaohan Chen)
-
-== 1.4.0
-
-* Made the code grabbing terminal size a little more cross-platform by
- adding support for Solaris. (patch by Ronald Braswell and Coey Minear)
-
-== 1.2.9
-
-* Additional work on the backspacing issue. (patch by Jeremy Hinegardner)
-* Fixed Readline prompt bug. (patch by Jeremy Hinegardner)
-
-== 1.2.8
-
-* Fixed backspacing past the prompt and interrupting a prompt bugs.
- (patch by Jeremy Hinegardner)
-
-== 1.2.7
-
-* Fixed the stty indent bug.
-* Fixed the echo backspace bug.
-* Added HighLine::track_eof=() setting to work are threaded eof?() calls.
-
-== 1.2.6
-
-Patch by Jeremy Hinegardner:
-
-* Added ColorScheme support.
-* Added HighLine::Question.overwrite mode.
-* Various documentation fixes.
-
-== 1.2.5
-
-* Really fixed the bug I tried to fix in 1.2.4.
-
-== 1.2.4
-
-* Fixed a crash causing bug when using menus, reported by Patrick Hof.
-
-== 1.2.3
-
-* Treat Cygwin like a Posix OS, instead of a native Windows environment.
-
-== 1.2.2
-
-* Minor documentation corrections.
-* Applied Thomas Werschleiln's patch to fix termio buffering on Solaris.
-* Applied Justin Bailey's patch to allow canceling paged output.
-* Fixed a documentation bug in the description of character case settings.
-* Added a notice about termios in HighLine::Question#echo.
-* Finally working around the infamous "fast typing" bug
-
-== 1.2.1
-
-* Applied Justin Bailey's fix for the page_print() infinite loop bug.
-* Made a SystemExtensions module to expose OS level functionality other
- libraries may want to access.
-* Publicly exposed the get_character() method, per user requests.
-* Added terminal_size(), output_cols(), and output_rows() methods.
-* Added :auto setting for warp_at=() and page_at=().
-
-== 1.2.0
-
-* Improved RubyForge and gem spec project descriptions.
-* Added basic examples to README.
-* Added a VERSION constant.
-* Added support for hidden menu commands.
-* Added Object.or_ask() when using highline/import.
-
-== 1.0.4
-
-* Moved the HighLine project to Subversion.
-* HighLine's color escapes can now be disabled.
-* Fixed EOF bug introduced in the last release.
-* Updated HighLine web page.
-* Moved to a forked development/stable version numbering.
-
-== 1.0.2
-
-* Removed old and broken help tests.
-* Fixed test case typo found by David A. Black.
-* Added ERb escapes processing to lists, for coloring list items. Color escapes
- do not add to list element size.
-* HighLine now throws EOFError when input is exhausted.
-
-== 1.0.1
-
-* Minor bug fix: Moved help initialization to before response building, so help
- would show up in the default responses.
-
-== 1.0.0
-
-* Fixed documentation typo pointed out by Gavin Kistner.
-* Added gather = ... option to question for fetching entire Arrays or
- Hashes filled with answers. You can set +gather+ to a count of answers to
- collect, a String or Regexp matching the end of input, or a Hash where each
- key can be used in a new question.
-* Added File support to HighLine.ask(). You can specify a _directory_ and a
- _glob_ pattern that combine into a list of file choices the user can select
- from. You can choose to receive the user's answer as an open filehandle or as
- a Pathname object.
-* Added Readline support for history and editing.
-* Added tab completion for menu and file selection selection (requires
- Readline).
-* Added an optional character limit for input.
-* Added a complete help system to HighLine's shell menu creation tools.
-
-== 0.6.1
-
-* Removed termios dependancy in gem, to fix Windows' install.
-
-== 0.6.0
-
-* Implemented HighLine.choose() for menu handling.
- * Provided shortcut choose(item1, item2, ...) for simple menus.
- * Allowed Ruby code to be attached to each menu item, to create a complete
- menu solution.
- * Provided for total customization of the menu layout.
- * Allowed for menu selection by index, name or both.
- * Added a _shell_ mode to allow menu selection with additional details
- following the name.
-* Added a list() utility method that can be invoked just like color(). It can
- layout Arrays for you in any output in the modes :columns_across,
- :columns_down, :inline and :rows
-* Added support for echo = "*" style settings. User code can now
- choose the echo character this way.
-* Modified HighLine to user the "termios" library for character input, if
- available. Will return to old behavior (using "stty"), if "termios" cannot be
- loaded.
-* Improved "stty" state restoring code.
-* Fixed "stty" code to handle interrupt signals.
-* Improved the default auto-complete error message and exposed this message
- through the +responses+ interface as :no_completion.
-
-== 0.5.0
-
-* Implemented echo = false for HighLine::Question objects, primarily to
- make fetching passwords trivial.
-* Fixed an auto-complete bug that could cause a crash when the user gave an
- answer that didn't complete to any valid choice.
-* Implemented +case+ for HighLine::Question objects to provide character case
- conversions on given answers. Can be set to :up, :down, or
- :capitalize.
-* Exposed @answer to the response system, to allow response that are
- aware of incorrect input.
-* Implemented +confirm+ for HighLine::Question objects to allow for verification
- for sensitive user choices. If set to +true+, user will have to answer an
- "Are you sure? " question. Can also be set to the question to confirm with
- the user.
-
-== 0.4.0
-
-* Added @wrap_at and @page_at settings and accessors to
- HighLine, to control text flow.
-* Implemented line wrapping with adjustable limit.
-* Implemented paged printing with adjustable limit.
-
-== 0.3.0
-
-* Added support for installing with setup.rb.
-* All output is now treated as an ERb sequence, allowing Ruby code to be
- embedded in output strings.
-* Added support for ANSI color sequences in say(). (And everything else
- by extension.)
-* Added whitespace handling for answers. Can be set to :strip,
- :chomp, :collapse, :strip_and_collapse,
- :chomp_and_collapse, :remove, or :none.
-* Exposed question details to ERb completion through @question, to allow for
- intelligent responses.
-* Simplified HighLine internals using @question.
-* Added support for fetching single character input either with getc() or
- HighLine's own cross-platform terminal input routine.
-* Improved type conversion to handle user defined classes.
-
-== 0.2.0
-
-* Added Unit Tests to cover an already fixed output bug in the future.
-* Added Rakefile and setup test action (default).
-* Renamed HighLine::Answer to HighLine::Question to better illustrate its role.
-* Renamed fetch_line() to get_response() to better define its goal.
-* Simplified explain_error in terms of the Question object.
-* Renamed accept?() to in_range?() to better define purpose.
-* Reworked valid?() into valid_answer?() to better fit Question object.
-* Reworked @member into @in, to make it easier to remember and
- switched implementation to include?().
-* Added range checks for @above and @below.
-* Fixed the bug causing ask() to swallow NoMethodErrors.
-* Rolled ask_on_error() into responses.
-* Redirected imports to Kernel from Object.
-* Added support for validate = lambda { ... }.
-* Added default answer support.
-* Fixed bug that caused ask() to die with an empty question.
-* Added complete documentation.
-* Improve the implemetation of agree() to be the intended "yes" or "no" only
- question.
-* Added Rake tasks for documentation and packaging.
-* Moved project to RubyForge.
-
-== 0.1.0
-
-* Initial release as the solution to
- {Ruby Quiz #29}[http://www.rubyquiz.com/quiz29.html].
diff --git a/vendor/gems/highline-1.5.0/INSTALL b/vendor/gems/highline-1.5.0/INSTALL
deleted file mode 100644
index c22f0414..00000000
--- a/vendor/gems/highline-1.5.0/INSTALL
+++ /dev/null
@@ -1,35 +0,0 @@
-= Installing HighLine
-
-RubyGems is the preferred easy install method for HighLine. However, you can
-install HighLine manually as described below.
-
-== Installing the Gem
-
-HighLine is intended to be installed via the
-RubyGems[http://rubyforge.org/projects/rubygems/] system. To get the latest
-version, simply enter the following into your command prompt:
-
- $ sudo gem install highline
-
-You must have RubyGems[http://rubyforge.org/projects/rubygems/] installed for
-the above to work.
-
-== Installing Manually
-
-Download the latest version of HighLine from the
-{RubyForge project page}[http://rubyforge.org/frs/?group_id=683]. Navigate to
-the root project directory and enter:
-
- $ sudo ruby setup.rb
-
-== Using termios
-
-While not a requirement, HighLine will take advantage of the termios library if
-installed (on Unix). This slightly improves HighLine's character reading
-capabilities and thus is recommended for all Unix users.
-
-If using the HighLine gem, you should be able to add termios as easily as:
-
- $ sudo gem install termios
-
-For manual installs, consult the termios documentation.
diff --git a/vendor/gems/highline-1.5.0/LICENSE b/vendor/gems/highline-1.5.0/LICENSE
deleted file mode 100644
index ff6f232c..00000000
--- a/vendor/gems/highline-1.5.0/LICENSE
+++ /dev/null
@@ -1,7 +0,0 @@
-= License Terms
-
-Distributed under the user's choice of the {GPL Version 2}[http://www.gnu.org/licenses/old-licenses/gpl-2.0.html] (see COPYING for details) or the
-{Ruby software license}[http://www.ruby-lang.org/en/LICENSE.txt] by
-James Edward Gray II and Greg Brown.
-
-Please email James[mailto:james@grayproductions.net] with any questions.
diff --git a/vendor/gems/highline-1.5.0/README b/vendor/gems/highline-1.5.0/README
deleted file mode 100644
index f28478bb..00000000
--- a/vendor/gems/highline-1.5.0/README
+++ /dev/null
@@ -1,63 +0,0 @@
-= Read Me
-
-by James Edward Gray II
-
-== Description
-
-Welcome to HighLine.
-
-HighLine was designed to ease the tedious tasks of doing console input and
-output with low-level methods like gets() and puts(). HighLine provides a
-robust system for requesting data from a user, without needing to code all the
-error checking and validation rules and without needing to convert the typed
-Strings into what your program really needs. Just tell HighLine what you're
-after, and let it do all the work.
-
-== Documentation
-
-See HighLine and HighLine::Question for documentation.
-
-== Examples
-
-Basic usage:
-
- ask("Company? ") { |q| q.default = "none" }
-
-Validation:
-
- ask("Age? ", Integer) { |q| q.in = 0..105 }
- ask("Name? (last, first) ") { |q| q.validate = /\A\w+, ?\w+\Z/ }
-
-Type conversion for answers:
-
- ask("Birthday? ", Date)
- ask("Interests? (comma sep list) ", lambda { |str| str.split(/,\s*/) })
-
-Reading passwords:
-
- ask("Enter your password: ") { |q| q.echo = false }
- ask("Enter your password: ") { |q| q.echo = "x" }
-
-ERb based output (with HighLine's ANSI color tools):
-
- say("This should be <%= color('bold', BOLD) %>!")
-
-Menus:
-
- choose do |menu|
- menu.prompt = "Please choose your favorite programming language? "
-
- menu.choice(:ruby) { say("Good choice!") }
- menu.choices(:python, :perl) { say("Not from around here, are you?") }
- end
-
-For more examples see the examples/ directory of this project.
-
-== Installing
-
-See the INSTALL file for instructions.
-
-== Questions and/or Comments
-
-Feel free to email {James Edward Gray II}[mailto:james@grayproductions.net] or
-{Gregory Brown}[mailto:gregory.t.brown@gmail.com] with any questions.
diff --git a/vendor/gems/highline-1.5.0/Rakefile b/vendor/gems/highline-1.5.0/Rakefile
deleted file mode 100644
index 26a68f00..00000000
--- a/vendor/gems/highline-1.5.0/Rakefile
+++ /dev/null
@@ -1,82 +0,0 @@
-require "rake/rdoctask"
-require "rake/testtask"
-require "rake/gempackagetask"
-
-require "rubygems"
-
-dir = File.dirname(__FILE__)
-lib = File.join(dir, "lib", "highline.rb")
-version = File.read(lib)[/^\s*VERSION\s*=\s*(['"])(\d\.\d\.\d)\1/, 2]
-
-task :default => [:test]
-
-Rake::TestTask.new do |test|
- test.libs << "test"
- test.test_files = [ "test/ts_all.rb" ]
- test.verbose = true
-end
-
-Rake::RDocTask.new do |rdoc|
- rdoc.rdoc_files.include( "README", "INSTALL",
- "TODO", "CHANGELOG",
- "AUTHORS", "COPYING",
- "LICENSE", "lib/" )
- rdoc.main = "README"
- rdoc.rdoc_dir = "doc/html"
- rdoc.title = "HighLine Documentation"
-end
-
-desc "Upload current documentation to Rubyforge"
-task :upload_docs => [:rdoc] do
- sh "scp -r doc/html/* " +
- "bbazzarrakk@rubyforge.org:/var/www/gforge-projects/highline/doc/"
- sh "scp -r site/* " +
- "bbazzarrakk@rubyforge.org:/var/www/gforge-projects/highline/"
-end
-
-spec = Gem::Specification.new do |spec|
- spec.name = "highline"
- spec.version = version
- spec.platform = Gem::Platform::RUBY
- spec.summary = "HighLine is a high-level command-line IO library."
- spec.files = Dir.glob("{examples,lib,test}/**/*.rb").
- delete_if { |item| item.include?("CVS") } +
- ["Rakefile", "setup.rb"]
-
- spec.test_suite_file = "test/ts_all.rb"
- spec.has_rdoc = true
- spec.extra_rdoc_files = %w{README INSTALL TODO CHANGELOG LICENSE}
- spec.rdoc_options << '--title' << 'HighLine Documentation' <<
- '--main' << 'README'
-
- spec.require_path = 'lib'
-
- spec.author = "James Edward Gray II"
- spec.email = "james@grayproductions.net"
- spec.rubyforge_project = "highline"
- spec.homepage = "http://highline.rubyforge.org"
- spec.description = <!")
- if i == 0
- say( "This should be " +
- "<%= color('white on #{c}', :white, :on_#{c}) %>!")
- else
- say( "This should be " +
- "<%= color( '#{colors[i - 1]} on #{c}',
- :#{colors[i - 1]}, :on_#{c} ) %>!")
- end
-end
-
-# Using color with constants.
-say("This should be <%= color('bold', BOLD) %>!")
-say("This should be <%= color('underlined', UNDERLINE) %>!")
-
-# Using constants only.
-say("This might even <%= BLINK %>blink<%= CLEAR %>!")
-
-# It even works with list wrapping.
-erb_digits = %w{Zero One Two Three Four} +
- ["<%= color('Five', :blue) %%>"] +
- %w{Six Seven Eight Nine}
-say("<%= list(#{erb_digits.inspect}, :columns_down, 3) %>")
diff --git a/vendor/gems/highline-1.5.0/examples/asking_for_arrays.rb b/vendor/gems/highline-1.5.0/examples/asking_for_arrays.rb
deleted file mode 100644
index 6c62a0e4..00000000
--- a/vendor/gems/highline-1.5.0/examples/asking_for_arrays.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/usr/local/bin/ruby -w
-
-# asking_for_arrays.rb
-#
-# Created by James Edward Gray II on 2005-07-05.
-# Copyright 2005 Gray Productions. All rights reserved.
-
-require "rubygems"
-require "highline/import"
-require "pp"
-
-grades = ask( "Enter test scores (or a blank line to quit):",
- lambda { |ans| ans =~ /^-?\d+$/ ? Integer(ans) : ans} ) do |q|
- q.gather = ""
-end
-
-say("Grades:")
-pp grades
diff --git a/vendor/gems/highline-1.5.0/examples/basic_usage.rb b/vendor/gems/highline-1.5.0/examples/basic_usage.rb
deleted file mode 100644
index 60ecdc18..00000000
--- a/vendor/gems/highline-1.5.0/examples/basic_usage.rb
+++ /dev/null
@@ -1,75 +0,0 @@
-#!/usr/local/bin/ruby -w
-
-# basic_usage.rb
-#
-# Created by James Edward Gray II on 2005-04-28.
-# Copyright 2005 Gray Productions. All rights reserved.
-
-require "rubygems"
-require "highline/import"
-require "yaml"
-
-contacts = [ ]
-
-class NameClass
- def self.parse( string )
- if string =~ /^\s*(\w+),\s*(\w+)\s*$/
- self.new($2, $1)
- else
- raise ArgumentError, "Invalid name format."
- end
- end
-
- def initialize(first, last)
- @first, @last = first, last
- end
-
- attr_reader :first, :last
-end
-
-begin
- entry = Hash.new
-
- # basic output
- say("Enter a contact:")
-
- # basic input
- entry[:name] = ask("Name? (last, first) ", NameClass) do |q|
- q.validate = /\A\w+, ?\w+\Z/
- end
- entry[:company] = ask("Company? ") { |q| q.default = "none" }
- entry[:address] = ask("Address? ")
- entry[:city] = ask("City? ")
- entry[:state] = ask("State? ") do |q|
- q.case = :up
- q.validate = /\A[A-Z]{2}\Z/
- end
- entry[:zip] = ask("Zip? ") do |q|
- q.validate = /\A\d{5}(?:-?\d{4})?\Z/
- end
- entry[:phone] = ask( "Phone? ",
- lambda { |p| p.delete("^0-9").
- sub(/\A(\d{3})/, '(\1) ').
- sub(/(\d{4})\Z/, '-\1') } ) do |q|
- q.validate = lambda { |p| p.delete("^0-9").length == 10 }
- q.responses[:not_valid] = "Enter a phone numer with area code."
- end
- entry[:age] = ask("Age? ", Integer) { |q| q.in = 0..105 }
- entry[:birthday] = ask("Birthday? ", Date)
- entry[:interests] = ask( "Interests? (comma separated list) ",
- lambda { |str| str.split(/,\s*/) } )
- entry[:description] = ask("Enter a description for this contact.") do |q|
- q.whitespace = :strip_and_collapse
- end
-
- contacts << entry
-# shortcut for yes and no questions
-end while agree("Enter another contact? ", true)
-
-if agree("Save these contacts? ", true)
- file_name = ask("Enter a file name: ") do |q|
- q.validate = /\A\w+\Z/
- q.confirm = true
- end
- File.open("#{file_name}.yaml", "w") { |file| YAML.dump(contacts, file) }
-end
diff --git a/vendor/gems/highline-1.5.0/examples/color_scheme.rb b/vendor/gems/highline-1.5.0/examples/color_scheme.rb
deleted file mode 100644
index 6d1e0a76..00000000
--- a/vendor/gems/highline-1.5.0/examples/color_scheme.rb
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/usr/bin/env ruby -w
-
-# color_scheme.rb
-#
-# Created by Jeremy Hinegardner on 2007-01-24
-# Copyright 2007 Jeremy Hinegardner. All rights reserved
-
-require 'rubygems'
-require 'highline/import'
-
-# Create a color scheme, naming color patterns with symbol names.
-ft = HighLine::ColorScheme.new do |cs|
- cs[:headline] = [ :bold, :yellow, :on_black ]
- cs[:horizontal_line] = [ :bold, :white, :on_blue]
- cs[:even_row] = [ :green ]
- cs[:odd_row] = [ :magenta ]
- end
-
-# Assign that color scheme to HighLine...
-HighLine.color_scheme = ft
-
-# ...and use it.
-say("<%= color('Headline', :headline) %>")
-say("<%= color('-'*20, :horizontal_line) %>")
-
-# Setup a toggle for rows.
-i = true
-("A".."D").each do |row|
- row_color = i ? :even_row : :odd_row
- say("<%= color('#{row}', '#{row_color}') %>")
- i = !i
-end
diff --git a/vendor/gems/highline-1.5.0/examples/menus.rb b/vendor/gems/highline-1.5.0/examples/menus.rb
deleted file mode 100644
index e31c11df..00000000
--- a/vendor/gems/highline-1.5.0/examples/menus.rb
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/usr/local/bin/ruby -w
-
-require "rubygems"
-require "highline/import"
-
-# The old way, using ask() and say()...
-choices = %w{ruby python perl}
-say("This is the old way using ask() and say()...")
-say("Please choose your favorite programming language:")
-say(choices.map { |c| " #{c}\n" }.join)
-
-case ask("? ", choices)
-when "ruby"
- say("Good choice!")
-else
- say("Not from around here, are you?")
-end
-
-# The new and improved choose()...
-say("\nThis is the new mode (default)...")
-choose do |menu|
- menu.prompt = "Please choose your favorite programming language? "
-
- menu.choice :ruby do say("Good choice!") end
- menu.choices(:python, :perl) do say("Not from around here, are you?") end
-end
-
-say("\nThis is letter indexing...")
-choose do |menu|
- menu.index = :letter
- menu.index_suffix = ") "
-
- menu.prompt = "Please choose your favorite programming language? "
-
- menu.choice :ruby do say("Good choice!") end
- menu.choices(:python, :perl) do say("Not from around here, are you?") end
-end
-
-say("\nThis is with a different layout...")
-choose do |menu|
- menu.layout = :one_line
-
- menu.header = "Languages"
- menu.prompt = "Favorite? "
-
- menu.choice :ruby do say("Good choice!") end
- menu.choices(:python, :perl) do say("Not from around here, are you?") end
-end
-
-say("\nYou can even build shells...")
-loop do
- choose do |menu|
- menu.layout = :menu_only
-
- menu.shell = true
-
- menu.choice(:load, "Load a file.") do |command, details|
- say("Loading file with options: #{details}...")
- end
- menu.choice(:save, "Save a file.") do |command, details|
- say("Saving file with options: #{details}...")
- end
- menu.choice(:quit, "Exit program.") { exit }
- end
-end
diff --git a/vendor/gems/highline-1.5.0/examples/overwrite.rb b/vendor/gems/highline-1.5.0/examples/overwrite.rb
deleted file mode 100644
index 1ca2db52..00000000
--- a/vendor/gems/highline-1.5.0/examples/overwrite.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/usr/local/bin/ruby -w
-
-# overwrite.rb
-#
-# Created by Jeremy Hinegardner on 2007-01-24
-# Copyright 2007 Jeremy Hinegardner. All rights reserved
-
-require 'rubygems'
-require 'highline/import'
-
-prompt = "here is your password:"
-ask(
- "#{prompt} <%= color('mypassword', RED, BOLD) %> (Press Any Key to blank) "
-) do |q|
- q.overwrite = true
- q.echo = false # overwrite works best when echo is false.
- q.character = true # if this is set to :getc then overwrite does not work
-end
-say("<%= color('Look! blanked out!', GREEN) %>")
diff --git a/vendor/gems/highline-1.5.0/examples/page_and_wrap.rb b/vendor/gems/highline-1.5.0/examples/page_and_wrap.rb
deleted file mode 100644
index 3209a4ab..00000000
--- a/vendor/gems/highline-1.5.0/examples/page_and_wrap.rb
+++ /dev/null
@@ -1,322 +0,0 @@
-#!/usr/local/bin/ruby -w
-
-# page_and_wrap.rb
-#
-# Created by James Edward Gray II on 2005-05-07.
-# Copyright 2005 Gray Productions. All rights reserved.
-
-require "rubygems"
-require "highline/import"
-
-$terminal.wrap_at = 80
-$terminal.page_at = 22
-
-say(<@question is set before ask() is called, parameters are
- # ignored and that object (must be a HighLine::Question) is used to drive
- # the process instead.
- #
- # Raises EOFError if input is exhausted.
- #
- def ask( question, answer_type = String, &details ) # :yields: question
- @question ||= Question.new(question, answer_type, &details)
-
- return gather if @question.gather
-
- # readline() needs to handle it's own output, but readline only supports
- # full line reading. Therefore if @question.echo is anything but true,
- # the prompt will not be issued. And we have to account for that now.
- say(@question) unless (@question.readline and @question.echo == true)
- begin
- @answer = @question.answer_or_default(get_response)
- unless @question.valid_answer?(@answer)
- explain_error(:not_valid)
- raise QuestionError
- end
-
- @answer = @question.convert(@answer)
-
- if @question.in_range?(@answer)
- if @question.confirm
- # need to add a layer of scope to ask a question inside a
- # question, without destroying instance data
- context_change = self.class.new(@input, @output, @wrap_at, @page_at)
- if @question.confirm == true
- confirm_question = "Are you sure? "
- else
- # evaluate ERb under initial scope, so it will have
- # access to @question and @answer
- template = ERB.new(@question.confirm, nil, "%")
- confirm_question = template.result(binding)
- end
- unless context_change.agree(confirm_question)
- explain_error(nil)
- raise QuestionError
- end
- end
-
- @answer
- else
- explain_error(:not_in_range)
- raise QuestionError
- end
- rescue QuestionError
- retry
- rescue ArgumentError
- explain_error(:invalid_type)
- retry
- rescue Question::NoAutoCompleteMatch
- explain_error(:no_completion)
- retry
- rescue NameError
- raise if $!.is_a?(NoMethodError)
- explain_error(:ambiguous_completion)
- retry
- ensure
- @question = nil # Reset Question object.
- end
- end
-
- #
- # This method is HighLine's menu handler. For simple usage, you can just
- # pass all the menu items you wish to display. At that point, choose() will
- # build and display a menu, walk the user through selection, and return
- # their choice amoung the provided items. You might use this in a case
- # statement for quick and dirty menus.
- #
- # However, choose() is capable of much more. If provided, a block will be
- # passed a HighLine::Menu object to configure. Using this method, you can
- # customize all the details of menu handling from index display, to building
- # a complete shell-like menuing system. See HighLine::Menu for all the
- # methods it responds to.
- #
- # Raises EOFError if input is exhausted.
- #
- def choose( *items, &details )
- @menu = @question = Menu.new(&details)
- @menu.choices(*items) unless items.empty?
-
- # Set _answer_type_ so we can double as the Question for ask().
- @menu.answer_type = if @menu.shell
- lambda do |command| # shell-style selection
- first_word = command.to_s.split.first || ""
-
- options = @menu.options
- options.extend(OptionParser::Completion)
- answer = options.complete(first_word)
-
- if answer.nil?
- raise Question::NoAutoCompleteMatch
- end
-
- [answer.last, command.sub(/^\s*#{first_word}\s*/, "")]
- end
- else
- @menu.options # normal menu selection, by index or name
- end
-
- # Provide hooks for ERb layouts.
- @header = @menu.header
- @prompt = @menu.prompt
-
- if @menu.shell
- selected = ask("Ignored", @menu.answer_type)
- @menu.select(self, *selected)
- else
- selected = ask("Ignored", @menu.answer_type)
- @menu.select(self, selected)
- end
- end
-
- #
- # This method provides easy access to ANSI color sequences, without the user
- # needing to remember to CLEAR at the end of each sequence. Just pass the
- # _string_ to color, followed by a list of _colors_ you would like it to be
- # affected by. The _colors_ can be HighLine class constants, or symbols
- # (:blue for BLUE, for example). A CLEAR will automatically be embedded to
- # the end of the returned String.
- #
- # This method returns the original _string_ unchanged if HighLine::use_color?
- # is +false+.
- #
- def color( string, *colors )
- return string unless self.class.use_color?
-
- colors.map! do |c|
- if self.class.using_color_scheme? and self.class.color_scheme.include? c
- self.class.color_scheme[c]
- elsif c.is_a? Symbol
- self.class.const_get(c.to_s.upcase)
- else
- c
- end
- end
- "#{colors.flatten.join}#{string}#{CLEAR}"
- end
-
- #
- # This method is a utility for quickly and easily laying out lists. It can
- # be accessed within ERb replacements of any text that will be sent to the
- # user.
- #
- # The only required parameter is _items_, which should be the Array of items
- # to list. A specified _mode_ controls how that list is formed and _option_
- # has different effects, depending on the _mode_. Recognized modes are:
- #
- # :columns_across:: _items_ will be placed in columns, flowing
- # from left to right. If given, _option_ is the
- # number of columns to be used. When absent,
- # columns will be determined based on _wrap_at_
- # or a default of 80 characters.
- # :columns_down:: Identical to :columns_across, save
- # flow goes down.
- # :inline:: All _items_ are placed on a single line. The
- # last two _items_ are separated by _option_ or
- # a default of " or ". All other _items_ are
- # separated by ", ".
- # :rows:: The default mode. Each of the _items_ is
- # placed on it's own line. The _option_
- # parameter is ignored in this mode.
- #
- # Each member of the _items_ Array is passed through ERb and thus can contain
- # their own expansions. Color escape expansions do not contribute to the
- # final field width.
- #
- def list( items, mode = :rows, option = nil )
- items = items.to_ary.map do |item|
- ERB.new(item, nil, "%").result(binding)
- end
-
- case mode
- when :inline
- option = " or " if option.nil?
-
- case items.size
- when 0
- ""
- when 1
- items.first
- when 2
- "#{items.first}#{option}#{items.last}"
- else
- items[0..-2].join(", ") + "#{option}#{items.last}"
- end
- when :columns_across, :columns_down
- max_length = actual_length(
- items.max { |a, b| actual_length(a) <=> actual_length(b) }
- )
-
- if option.nil?
- limit = @wrap_at || 80
- option = (limit + 2) / (max_length + 2)
- end
-
- items = items.map do |item|
- pad = max_length + (item.length - actual_length(item))
- "%-#{pad}s" % item
- end
- row_count = (items.size / option.to_f).ceil
-
- if mode == :columns_across
- rows = Array.new(row_count) { Array.new }
- items.each_with_index do |item, index|
- rows[index / option] << item
- end
-
- rows.map { |row| row.join(" ") + "\n" }.join
- else
- columns = Array.new(option) { Array.new }
- items.each_with_index do |item, index|
- columns[index / row_count] << item
- end
-
- list = ""
- columns.first.size.times do |index|
- list << columns.map { |column| column[index] }.
- compact.join(" ") + "\n"
- end
- list
- end
- else
- items.map { |i| "#{i}\n" }.join
- end
- end
-
- #
- # The basic output method for HighLine objects. If the provided _statement_
- # ends with a space or tab character, a newline will not be appended (output
- # will be flush()ed). All other cases are passed straight to Kernel.puts().
- #
- # The _statement_ parameter is processed as an ERb template, supporting
- # embedded Ruby code. The template is evaluated with a binding inside
- # the HighLine instance, providing easy access to the ANSI color constants
- # and the HighLine.color() method.
- #
- def say( statement )
- statement = statement.to_str
- return unless statement.length > 0
-
- template = ERB.new(statement, nil, "%")
- statement = template.result(binding)
-
- statement = wrap(statement) unless @wrap_at.nil?
- statement = page_print(statement) unless @page_at.nil?
-
- if statement[-1, 1] == " " or statement[-1, 1] == "\t"
- @output.print(statement)
- @output.flush
- else
- @output.puts(statement)
- end
- end
-
- #
- # Set to an integer value to cause HighLine to wrap output lines at the
- # indicated character limit. When +nil+, the default, no wrapping occurs. If
- # set to :auto, HighLine will attempt to determing the columns
- # available for the @output or use a sensible default.
- #
- def wrap_at=( setting )
- @wrap_at = setting == :auto ? output_cols : setting
- end
-
- #
- # Set to an integer value to cause HighLine to page output lines over the
- # indicated line limit. When +nil+, the default, no paging occurs. If
- # set to :auto, HighLine will attempt to determing the rows available
- # for the @output or use a sensible default.
- #
- def page_at=( setting )
- @page_at = setting == :auto ? output_rows : setting
- end
-
- #
- # Returns the number of columns for the console, or a default it they cannot
- # be determined.
- #
- def output_cols
- return 80 unless @output.tty?
- terminal_size.first
- rescue
- return 80
- end
-
- #
- # Returns the number of rows for the console, or a default if they cannot be
- # determined.
- #
- def output_rows
- return 24 unless @output.tty?
- terminal_size.last
- rescue
- return 24
- end
-
- private
-
- #
- # A helper method for sending the output stream and error and repeat
- # of the question.
- #
- def explain_error( error )
- say(@question.responses[error]) unless error.nil?
- if @question.responses[:ask_on_error] == :question
- say(@question)
- elsif @question.responses[:ask_on_error]
- say(@question.responses[:ask_on_error])
- end
- end
-
- #
- # Collects an Array/Hash full of answers as described in
- # HighLine::Question.gather().
- #
- # Raises EOFError if input is exhausted.
- #
- def gather( )
- @gather = @question.gather
- @answers = [ ]
- original_question = @question
-
- @question.gather = false
-
- case @gather
- when Integer
- @answers << ask(@question)
- @gather -= 1
-
- original_question.question = ""
- until @gather.zero?
- @question = original_question
- @answers << ask(@question)
- @gather -= 1
- end
- when String, Regexp
- @answers << ask(@question)
-
- original_question.question = ""
- until (@gather.is_a?(String) and @answers.last.to_s == @gather) or
- (@gather.is_a?(Regexp) and @answers.last.to_s =~ @gather)
- @question = original_question
- @answers << ask(@question)
- end
-
- @answers.pop
- when Hash
- @answers = { }
- @gather.keys.sort.each do |key|
- @question = original_question
- @key = key
- @answers[key] = ask(@question)
- end
- end
-
- @answers
- end
-
- #
- # Read a line of input from the input stream and process whitespace as
- # requested by the Question object.
- #
- # If Question's _readline_ property is set, that library will be used to
- # fetch input. *WARNING*: This ignores the currently set input stream.
- #
- # Raises EOFError if input is exhausted.
- #
- def get_line( )
- if @question.readline
- require "readline" # load only if needed
-
- # capture say()'s work in a String to feed to readline()
- old_output = @output
- @output = StringIO.new
- say(@question)
- question = @output.string
- @output = old_output
-
- # prep auto-completion
- Readline.completion_proc = lambda do |string|
- @question.selection.grep(/\A#{Regexp.escape(string)}/)
- end
-
- # work-around ugly readline() warnings
- old_verbose = $VERBOSE
- $VERBOSE = nil
- answer = @question.change_case(
- @question.remove_whitespace(
- Readline.readline(question, true) ) )
- $VERBOSE = old_verbose
-
- answer
- else
- raise EOFError, "The input stream is exhausted." if @@track_eof and
- @input.eof?
-
- @question.change_case(@question.remove_whitespace(@input.gets))
- end
- end
-
- #
- # Return a line or character of input, as requested for this question.
- # Character input will be returned as a single character String,
- # not an Integer.
- #
- # This question's _first_answer_ will be returned instead of input, if set.
- #
- # Raises EOFError if input is exhausted.
- #
- def get_response( )
- return @question.first_answer if @question.first_answer?
-
- if @question.character.nil?
- if @question.echo == true and @question.limit.nil?
- get_line
- else
- raw_no_echo_mode if stty = CHARACTER_MODE == "stty"
-
- line = ""
- backspace_limit = 0
- begin
-
- while character = (stty ? @input.getc : get_character(@input))
- # honor backspace and delete
- if character == 127 or character == 8
- line.slice!(-1, 1)
- backspace_limit -= 1
- else
- line << character.chr
- backspace_limit = line.size
- end
- # looking for carriage return (decimal 13) or
- # newline (decimal 10) in raw input
- break if character == 13 or character == 10 or
- (@question.limit and line.size == @question.limit)
- if @question.echo != false
- if character == 127 or character == 8
- # only backspace if we have characters on the line to
- # eliminate, otherwise we'll tromp over the prompt
- if backspace_limit >= 0 then
- @output.print("\b#{ERASE_CHAR}")
- else
- # do nothing
- end
- else
- @output.print(@question.echo)
- end
- @output.flush
- end
- end
- ensure
- restore_mode if stty
- end
- if @question.overwrite
- @output.print("\r#{ERASE_LINE}")
- @output.flush
- else
- say("\n")
- end
-
- @question.change_case(@question.remove_whitespace(line))
- end
- elsif @question.character == :getc
- @question.change_case(@input.getc.chr)
- else
- response = get_character(@input).chr
- if @question.overwrite
- @output.print("\r#{ERASE_LINE}")
- @output.flush
- else
- echo = if @question.echo == true
- response
- elsif @question.echo != false
- @question.echo
- else
- ""
- end
- say("#{echo}\n")
- end
- @question.change_case(response)
- end
- end
-
- #
- # Page print a series of at most _page_at_ lines for _output_. After each
- # page is printed, HighLine will pause until the user presses enter/return
- # then display the next page of data.
- #
- # Note that the final page of _output_ is *not* printed, but returned
- # instead. This is to support any special handling for the final sequence.
- #
- def page_print( output )
- lines = output.scan(/[^\n]*\n?/)
- while lines.size > @page_at
- @output.puts lines.slice!(0...@page_at).join
- @output.puts
- # Return last line if user wants to abort paging
- return (["...\n"] + lines.slice(-2,1)).join unless continue_paging?
- end
- return lines.join
- end
-
- #
- # Ask user if they wish to continue paging output. Allows them to type "q" to
- # cancel the paging process.
- #
- def continue_paging?
- command = HighLine.new(@input, @output).ask(
- "-- press enter/return to continue or q to stop -- "
- ) { |q| q.character = true }
- command !~ /\A[qQ]\Z/ # Only continue paging if Q was not hit.
- end
-
- #
- # Wrap a sequence of _lines_ at _wrap_at_ characters per line. Existing
- # newlines will not be affected by this process, but additional newlines
- # may be added.
- #
- def wrap( lines )
- wrapped = [ ]
- lines.each do |line|
- while line =~ /([^\n]{#{@wrap_at + 1},})/
- search = $1.dup
- replace = $1.dup
- if index = replace.rindex(" ", @wrap_at)
- replace[index, 1] = "\n"
- replace.sub!(/\n[ \t]+/, "\n")
- line.sub!(search, replace)
- else
- line[@wrap_at, 0] = "\n"
- end
- end
- wrapped << line
- end
- return wrapped.join
- end
-
- #
- # Returns the length of the passed +string_with_escapes+, minus and color
- # sequence escapes.
- #
- def actual_length( string_with_escapes )
- string_with_escapes.gsub(/\e\[\d{1,2}m/, "").length
- end
-end
diff --git a/vendor/gems/highline-1.5.0/lib/highline/color_scheme.rb b/vendor/gems/highline-1.5.0/lib/highline/color_scheme.rb
deleted file mode 100644
index e7cbdf99..00000000
--- a/vendor/gems/highline-1.5.0/lib/highline/color_scheme.rb
+++ /dev/null
@@ -1,120 +0,0 @@
-#!/usr/local/bin/ruby -w
-
-# color_scheme.rb
-#
-# Created by Jeremy Hinegardner on 2007-01-24
-# Copyright 2007. All rights reserved
-#
-# This is Free Software. See LICENSE and COPYING for details
-
-require 'highline'
-
-class HighLine
- #
- # ColorScheme objects encapsulate a named set of colors to be used in the
- # HighLine.colors() method call. For example, by applying a ColorScheme that
- # has a :warning color then the following could be used:
- #
- # colors("This is a warning", :warning)
- #
- # A ColorScheme contains named sets of HighLine color constants.
- #
- # Example: Instantiating a color scheme, applying it to HighLine,
- # and using it:
- #
- # ft = HighLine::ColorScheme.new do |cs|
- # cs[:headline] = [ :bold, :yellow, :on_black ]
- # cs[:horizontal_line] = [ :bold, :white ]
- # cs[:even_row] = [ :green ]
- # cs[:odd_row] = [ :magenta ]
- # end
- #
- # HighLine.color_scheme = ft
- # say("<%= color('Headline', :headline) %>")
- # say("<%= color('-'*20, :horizontal_line) %>")
- # i = true
- # ("A".."D").each do |row|
- # if i then
- # say("<%= color('#{row}', :even_row ) %>")
- # else
- # say("<%= color('#{row}', :odd_row) %>")
- # end
- # i = !i
- # end
- #
- #
- class ColorScheme
- #
- # Create an instance of HighLine::ColorScheme. The customization can
- # happen as a passed in Hash or via the yielded block. Key's are
- # converted to :symbols and values are converted to HighLine
- # constants.
- #
- def initialize( h = nil )
- @scheme = Hash.new
- load_from_hash(h) unless h.nil?
- yield self if block_given?
- end
-
- # Load multiple colors from key/value pairs.
- def load_from_hash( h )
- h.each_pair do |color_tag, constants|
- self[color_tag] = constants
- end
- end
-
- # Does this color scheme include the given tag name?
- def include?( color_tag )
- @scheme.keys.include?(to_symbol(color_tag))
- end
-
- # Allow the scheme to be accessed like a Hash.
- def []( color_tag )
- @scheme[to_symbol(color_tag)]
- end
-
- # Allow the scheme to be set like a Hash.
- def []=( color_tag, constants )
- @scheme[to_symbol(color_tag)] = constants.map { |c| to_constant(c) }
- end
-
- private
-
- # Return a normalized representation of a color name.
- def to_symbol( t )
- t.to_s.downcase
- end
-
- # Return a normalized representation of a color setting.
- def to_constant( v )
- v = v.to_s if v.is_a?(Symbol)
- if v.is_a?(String) then
- HighLine.const_get(v.upcase)
- else
- v
- end
- end
- end
-
- # A sample ColorScheme.
- class SampleColorScheme < ColorScheme
- #
- # Builds the sample scheme with settings for :critical,
- # :error, :warning, :notice, :info,
- # :debug, :row_even, and :row_odd colors.
- #
- def initialize( h = nil )
- scheme = {
- :critical => [ :yellow, :on_red ],
- :error => [ :bold, :red ],
- :warning => [ :bold, :yellow ],
- :notice => [ :bold, :magenta ],
- :info => [ :bold, :cyan ],
- :debug => [ :bold, :green ],
- :row_even => [ :cyan ],
- :row_odd => [ :magenta ]
- }
- super(scheme)
- end
- end
-end
diff --git a/vendor/gems/highline-1.5.0/lib/highline/import.rb b/vendor/gems/highline-1.5.0/lib/highline/import.rb
deleted file mode 100644
index 579a9734..00000000
--- a/vendor/gems/highline-1.5.0/lib/highline/import.rb
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/usr/local/bin/ruby -w
-
-# import.rb
-#
-# Created by James Edward Gray II on 2005-04-26.
-# Copyright 2005 Gray Productions. All rights reserved.
-#
-# This is Free Software. See LICENSE and COPYING for details.
-
-require "highline"
-require "forwardable"
-
-$terminal = HighLine.new
-
-#
-# require "highline/import" adds shortcut methods to Kernel, making
-# agree(), ask(), choose() and say() globally available. This is handy for
-# quick and dirty input and output. These methods use the HighLine object in
-# the global variable $terminal, which is initialized to used
-# $stdin and $stdout (you are free to change this).
-# Otherwise, these methods are identical to their HighLine counterparts, see that
-# class for detailed explanations.
-#
-module Kernel
- extend Forwardable
- def_delegators :$terminal, :agree, :ask, :choose, :say
-end
-
-class Object
- #
- # Tries this object as a _first_answer_ for a HighLine::Question. See that
- # attribute for details.
- #
- # *Warning*: This Object will be passed to String() before set.
- #
- def or_ask( *args, &details )
- ask(*args) do |question|
- question.first_answer = String(self) unless nil?
-
- details.call(question) unless details.nil?
- end
- end
-end
diff --git a/vendor/gems/highline-1.5.0/lib/highline/menu.rb b/vendor/gems/highline-1.5.0/lib/highline/menu.rb
deleted file mode 100644
index ad992ac0..00000000
--- a/vendor/gems/highline-1.5.0/lib/highline/menu.rb
+++ /dev/null
@@ -1,395 +0,0 @@
-#!/usr/local/bin/ruby -w
-
-# menu.rb
-#
-# Created by Gregory Thomas Brown on 2005-05-10.
-# Copyright 2005. All rights reserved.
-#
-# This is Free Software. See LICENSE and COPYING for details.
-
-require "highline/question"
-
-class HighLine
- #
- # Menu objects encapsulate all the details of a call to HighLine.choose().
- # Using the accessors and Menu.choice() and Menu.choices(), the block passed
- # to HighLine.choose() can detail all aspects of menu display and control.
- #
- class Menu < Question
- #
- # Create an instance of HighLine::Menu. All customization is done
- # through the passed block, which should call accessors and choice() and
- # choices() as needed to define the Menu. Note that Menus are also
- # Questions, so all that functionality is available to the block as
- # well.
- #
- def initialize( )
- #
- # Initialize Question objects with ignored values, we'll
- # adjust ours as needed.
- #
- super("Ignored", [ ], &nil) # avoiding passing the block along
-
- @items = [ ]
- @hidden_items = [ ]
- @help = Hash.new("There's no help for that topic.")
-
- @index = :number
- @index_suffix = ". "
- @select_by = :index_or_name
- @flow = :rows
- @list_option = nil
- @header = nil
- @prompt = "? "
- @layout = :list
- @shell = false
- @nil_on_handled = false
-
- # Override Questions responses, we'll set our own.
- @responses = { }
- # Context for action code.
- @highline = nil
-
- yield self if block_given?
-
- init_help if @shell and not @help.empty?
- update_responses # rebuild responses based on our settings
- end
-
- #
- # An _index_ to append to each menu item in display. See
- # Menu.index=() for details.
- #
- attr_reader :index
- #
- # The String placed between an _index_ and a menu item. Defaults to
- # ". ". Switches to " ", when _index_ is set to a String (like "-").
- #
- attr_accessor :index_suffix
- #
- # The _select_by_ attribute controls how the user is allowed to pick a
- # menu item. The available choices are:
- #
- # :index:: The user is allowed to type the numerical
- # or alphetical index for their selection.
- # :index_or_name:: Allows both methods from the
- # :index option and the
- # :name option.
- # :name:: Menu items are selected by typing a portion
- # of the item name that will be
- # auto-completed.
- #
- attr_accessor :select_by
- #
- # This attribute is passed directly on as the mode to HighLine.list() by
- # all the preset layouts. See that method for appropriate settings.
- #
- attr_accessor :flow
- #
- # This setting is passed on as the third parameter to HighLine.list()
- # by all the preset layouts. See that method for details of its
- # effects. Defaults to +nil+.
- #
- attr_accessor :list_option
- #
- # Used by all the preset layouts to display title and/or introductory
- # information, when set. Defaults to +nil+.
- #
- attr_accessor :header
- #
- # Used by all the preset layouts to ask the actual question to fetch a
- # menu selection from the user. Defaults to "? ".
- #
- attr_accessor :prompt
- #
- # An ERb _layout_ to use when displaying this Menu object. See
- # Menu.layout=() for details.
- #
- attr_reader :layout
- #
- # When set to +true+, responses are allowed to be an entire line of
- # input, including details beyond the command itself. Only the first
- # "word" of input will be matched against the menu choices, but both the
- # command selected and the rest of the line will be passed to provided
- # action blocks. Defaults to +false+.
- #
- attr_accessor :shell
- #
- # When +true+, any selected item handled by provided action code, will
- # return +nil+, instead of the results to the action code. This may
- # prove handy when dealing with mixed menus where only the names of
- # items without any code (and +nil+, of course) will be returned.
- # Defaults to +false+.
- #
- attr_accessor :nil_on_handled
-
- #
- # Adds _name_ to the list of available menu items. Menu items will be
- # displayed in the order they are added.
- #
- # An optional _action_ can be associated with this name and if provided,
- # it will be called if the item is selected. The result of the method
- # will be returned, unless _nil_on_handled_ is set (when you would get
- # +nil+ instead). In _shell_ mode, a provided block will be passed the
- # command chosen and any details that followed the command. Otherwise,
- # just the command is passed. The @highline variable is set to
- # the current HighLine context before the action code is called and can
- # thus be used for adding output and the like.
- #
- def choice( name, help = nil, &action )
- @items << [name, action]
-
- @help[name.to_s.downcase] = help unless help.nil?
- end
-
- #
- # A shortcut for multiple calls to the sister method choice(). Be
- # warned: An _action_ set here will apply to *all* provided
- # _names_. This is considered to be a feature, so you can easily
- # hand-off interface processing to a different chunk of code.
- #
- def choices( *names, &action )
- names.each { |n| choice(n, &action) }
- end
-
- # Identical to choice(), but the item will not be listed for the user.
- def hidden( name, help = nil, &action )
- @hidden_items << [name, action]
-
- @help[name.to_s.downcase] = help unless help.nil?
- end
-
- #
- # Sets the indexing style for this Menu object. Indexes are appended to
- # menu items, when displayed in list form. The available settings are:
- #
- # :number:: Menu items will be indexed numerically, starting
- # with 1. This is the default method of indexing.
- # :letter:: Items will be indexed alphabetically, starting
- # with a.
- # :none:: No index will be appended to menu items.
- # any String:: Will be used as the literal _index_.
- #
- # Setting the _index_ to :none a literal String, also adjusts
- # _index_suffix_ to a single space and _select_by_ to :none.
- # Because of this, you should make a habit of setting the _index_ first.
- #
- def index=( style )
- @index = style
-
- # Default settings.
- if @index == :none or @index.is_a?(String)
- @index_suffix = " "
- @select_by = :name
- end
- end
-
- #
- # Initializes the help system by adding a :help choice, some
- # action code, and the default help listing.
- #
- def init_help( )
- return if @items.include?(:help)
-
- topics = @help.keys.sort
- help_help = @help.include?("help") ? @help["help"] :
- "This command will display helpful messages about " +
- "functionality, like this one. To see the help for " +
- "a specific topic enter:\n\thelp [TOPIC]\nTry asking " +
- "for help on any of the following:\n\n" +
- "<%= list(#{topics.inspect}, :columns_across) %>"
- choice(:help, help_help) do |command, topic|
- topic.strip!
- topic.downcase!
- if topic.empty?
- @highline.say(@help["help"])
- else
- @highline.say("= #{topic}\n\n#{@help[topic]}")
- end
- end
- end
-
- #
- # Used to set help for arbitrary topics. Use the topic "help"
- # to override the default message.
- #
- def help( topic, help )
- @help[topic] = help
- end
-
- #
- # Setting a _layout_ with this method also adjusts some other attributes
- # of the Menu object, to ideal defaults for the chosen _layout_. To
- # account for that, you probably want to set a _layout_ first in your
- # configuration block, if needed.
- #
- # Accepted settings for _layout_ are:
- #
- # :list:: The default _layout_. The _header_ if set
- # will appear at the top on its own line with
- # a trailing colon. Then the list of menu
- # items will follow. Finally, the _prompt_
- # will be used as the ask()-like question.
- # :one_line:: A shorter _layout_ that fits on one line.
- # The _header_ comes first followed by a
- # colon and spaces, then the _prompt_ with menu
- # items between trailing parenthesis.
- # :menu_only:: Just the menu items, followed up by a likely
- # short _prompt_.
- # any ERb String:: Will be taken as the literal _layout_. This
- # String can access @header,
- # @menu and @prompt, but is
- # otherwise evaluated in the typical HighLine
- # context, to provide access to utilities like
- # HighLine.list() primarily.
- #
- # If set to either :one_line, or :menu_only, _index_
- # will default to :none and _flow_ will default to
- # :inline.
- #
- def layout=( new_layout )
- @layout = new_layout
-
- # Default settings.
- case @layout
- when :one_line, :menu_only
- self.index = :none
- @flow = :inline
- end
- end
-
- #
- # This method returns all possible options for auto-completion, based
- # on the settings of _index_ and _select_by_.
- #
- def options( )
- # add in any hidden menu commands
- @items.concat(@hidden_items)
-
- by_index = if @index == :letter
- l_index = "`"
- @items.map { "#{l_index.succ!}" }
- else
- (1 .. @items.size).collect { |s| String(s) }
- end
- by_name = @items.collect { |c| c.first }
-
- case @select_by
- when :index then
- by_index
- when :name
- by_name
- else
- by_index + by_name
- end
- ensure
- # make sure the hidden items are removed, before we return
- @items.slice!(@items.size - @hidden_items.size, @hidden_items.size)
- end
-
- #
- # This method processes the auto-completed user selection, based on the
- # rules for this Menu object. If an action was provided for the
- # selection, it will be executed as described in Menu.choice().
- #
- def select( highline_context, selection, details = nil )
- # add in any hidden menu commands
- @items.concat(@hidden_items)
-
- # Find the selected action.
- name, action = if selection =~ /^\d+$/
- @items[selection.to_i - 1]
- else
- l_index = "`"
- index = @items.map { "#{l_index.succ!}" }.index(selection)
- @items.find { |c| c.first == selection } or @items[index]
- end
-
- # Run or return it.
- if not @nil_on_handled and not action.nil?
- @highline = highline_context
- if @shell
- action.call(name, details)
- else
- action.call(name)
- end
- elsif action.nil?
- name
- else
- nil
- end
- ensure
- # make sure the hidden items are removed, before we return
- @items.slice!(@items.size - @hidden_items.size, @hidden_items.size)
- end
-
- #
- # Allows Menu objects to pass as Arrays, for use with HighLine.list().
- # This method returns all menu items to be displayed, complete with
- # indexes.
- #
- def to_ary( )
- case @index
- when :number
- @items.map { |c| "#{@items.index(c) + 1}#{@index_suffix}#{c.first}" }
- when :letter
- l_index = "`"
- @items.map { |c| "#{l_index.succ!}#{@index_suffix}#{c.first}" }
- when :none
- @items.map { |c| "#{c.first}" }
- else
- @items.map { |c| "#{index}#{@index_suffix}#{c.first}" }
- end
- end
-
- #
- # Allows Menu to behave as a String, just like Question. Returns the
- # _layout_ to be rendered, which is used by HighLine.say().
- #
- def to_str( )
- case @layout
- when :list
- '<%= if @header.nil? then '' else "#{@header}:\n" end %>' +
- "<%= list( @menu, #{@flow.inspect},
- #{@list_option.inspect} ) %>" +
- "<%= @prompt %>"
- when :one_line
- '<%= if @header.nil? then '' else "#{@header}: " end %>' +
- "<%= @prompt %>" +
- "(<%= list( @menu, #{@flow.inspect},
- #{@list_option.inspect} ) %>)" +
- "<%= @prompt[/\s*$/] %>"
- when :menu_only
- "<%= list( @menu, #{@flow.inspect},
- #{@list_option.inspect} ) %><%= @prompt %>"
- else
- @layout
- end
- end
-
- #
- # This method will update the intelligent responses to account for
- # Menu specific differences. This overrides the work done by
- # Question.build_responses().
- #
- def update_responses( )
- append_default unless default.nil?
- @responses = { :ambiguous_completion =>
- "Ambiguous choice. " +
- "Please choose one of #{options.inspect}.",
- :ask_on_error =>
- "? ",
- :invalid_type =>
- "You must enter a valid #{options}.",
- :no_completion =>
- "You must choose one of " +
- "#{options.inspect}.",
- :not_in_range =>
- "Your answer isn't within the expected range " +
- "(#{expected_range}).",
- :not_valid =>
- "Your answer isn't valid (must match " +
- "#{@validate.inspect})." }.merge(@responses)
- end
- end
-end
diff --git a/vendor/gems/highline-1.5.0/lib/highline/question.rb b/vendor/gems/highline-1.5.0/lib/highline/question.rb
deleted file mode 100644
index a3d89cc6..00000000
--- a/vendor/gems/highline-1.5.0/lib/highline/question.rb
+++ /dev/null
@@ -1,462 +0,0 @@
-#!/usr/local/bin/ruby -w
-
-# question.rb
-#
-# Created by James Edward Gray II on 2005-04-26.
-# Copyright 2005 Gray Productions. All rights reserved.
-#
-# This is Free Software. See LICENSE and COPYING for details.
-
-require "optparse"
-require "date"
-require "pathname"
-
-class HighLine
- #
- # Question objects contain all the details of a single invocation of
- # HighLine.ask(). The object is initialized by the parameters passed to
- # HighLine.ask() and then queried to make sure each step of the input
- # process is handled according to the users wishes.
- #
- class Question
- # An internal HighLine error. User code does not need to trap this.
- class NoAutoCompleteMatch < StandardError
- # do nothing, just creating a unique error type
- end
-
- #
- # Create an instance of HighLine::Question. Expects a _question_ to ask
- # (can be "") and an _answer_type_ to convert the answer to.
- # The _answer_type_ parameter must be a type recongnized by
- # Question.convert(). If given, a block is yeilded the new Question
- # object to allow custom initializaion.
- #
- def initialize( question, answer_type )
- # initialize instance data
- @question = question
- @answer_type = answer_type
-
- @character = nil
- @limit = nil
- @echo = true
- @readline = false
- @whitespace = :strip
- @case = nil
- @default = nil
- @validate = nil
- @above = nil
- @below = nil
- @in = nil
- @confirm = nil
- @gather = false
- @first_answer = nil
- @directory = Pathname.new(File.expand_path(File.dirname($0)))
- @glob = "*"
- @responses = Hash.new
- @overwrite = false
-
- # allow block to override settings
- yield self if block_given?
-
- # finalize responses based on settings
- build_responses
- end
-
- # The ERb template of the question to be asked.
- attr_accessor :question
- # The type that will be used to convert this answer.
- attr_accessor :answer_type
- #
- # Can be set to +true+ to use HighLine's cross-platform character reader
- # instead of fetching an entire line of input. (Note: HighLine's
- # character reader *ONLY* supports STDIN on Windows and Unix.) Can also
- # be set to :getc to use that method on the input stream.
- #
- # *WARNING*: The _echo_ and _overwrite_ attributes for a question are
- # ignored when using the :getc method.
- #
- attr_accessor :character
- #
- # Allows you to set a character limit for input.
- #
- # *WARNING*: This option forces a character by character read.
- #
- attr_accessor :limit
- #
- # Can be set to +true+ or +false+ to control whether or not input will
- # be echoed back to the user. A setting of +true+ will cause echo to
- # match input, but any other true value will be treated as to String to
- # echo for each character typed.
- #
- # This requires HighLine's character reader. See the _character_
- # attribute for details.
- #
- # *Note*: When using HighLine to manage echo on Unix based systems, we
- # recommend installing the termios gem. Without it, it's possible to type
- # fast enough to have letters still show up (when reading character by
- # character only).
- #
- attr_accessor :echo
- #
- # Use the Readline library to fetch input. This allows input editing as
- # well as keeping a history. In addition, tab will auto-complete
- # within an Array of choices or a file listing.
- #
- # *WARNING*: This option is incompatible with all of HighLine's
- # character reading modes and it causes HighLine to ignore the
- # specified _input_ stream.
- #
- attr_accessor :readline
- #
- # Used to control whitespace processing for the answer to this question.
- # See HighLine::Question.remove_whitespace() for acceptable settings.
- #
- attr_accessor :whitespace
- #
- # Used to control character case processing for the answer to this question.
- # See HighLine::Question.change_case() for acceptable settings.
- #
- attr_accessor :case
- # Used to provide a default answer to this question.
- attr_accessor :default
- #
- # If set to a Regexp, the answer must match (before type conversion).
- # Can also be set to a Proc which will be called with the provided
- # answer to validate with a +true+ or +false+ return.
- #
- attr_accessor :validate
- # Used to control range checks for answer.
- attr_accessor :above, :below
- # If set, answer must pass an include?() check on this object.
- attr_accessor :in
- #
- # Asks a yes or no confirmation question, to ensure a user knows what
- # they have just agreed to. If set to +true+ the question will be,
- # "Are you sure? " Any other true value for this attribute is assumed
- # to be the question to ask. When +false+ or +nil+ (the default),
- # answers are not confirmed.
- #
- attr_accessor :confirm
- #
- # When set, the user will be prompted for multiple answers which will
- # be collected into an Array or Hash and returned as the final answer.
- #
- # You can set _gather_ to an Integer to have an Array of exactly that
- # many answers collected, or a String/Regexp to match an end input which
- # will not be returned in the Array.
- #
- # Optionally _gather_ can be set to a Hash. In this case, the question
- # will be asked once for each key and the answers will be returned in a
- # Hash, mapped by key. The @key variable is set before each
- # question is evaluated, so you can use it in your question.
- #
- attr_accessor :gather
- #
- # When set to a non *nil* value, this will be tried as an answer to the
- # question. If this answer passes validations, it will become the result
- # without the user ever being prompted. Otherwise this value is discarded,
- # and this Question is resolved as a normal call to HighLine.ask().
- #
- attr_writer :first_answer
- #
- # The directory from which a user will be allowed to select files, when
- # File or Pathname is specified as an _answer_type_. Initially set to
- # Pathname.new(File.expand_path(File.dirname($0))).
- #
- attr_accessor :directory
- #
- # The glob pattern used to limit file selection when File or Pathname is
- # specified as an _answer_type_. Initially set to "*".
- #
- attr_accessor :glob
- #
- # A Hash that stores the various responses used by HighLine to notify
- # the user. The currently used responses and their purpose are as
- # follows:
- #
- # :ambiguous_completion:: Used to notify the user of an
- # ambiguous answer the auto-completion
- # system cannot resolve.
- # :ask_on_error:: This is the question that will be
- # redisplayed to the user in the event
- # of an error. Can be set to
- # :question to repeat the
- # original question.
- # :invalid_type:: The error message shown when a type
- # conversion fails.
- # :no_completion:: Used to notify the user that their
- # selection does not have a valid
- # auto-completion match.
- # :not_in_range:: Used to notify the user that a
- # provided answer did not satisfy
- # the range requirement tests.
- # :not_valid:: The error message shown when
- # validation checks fail.
- #
- attr_reader :responses
- #
- # When set to +true+ the question is asked, but output does not progress to
- # the next line. The Cursor is moved back to the beginning of the question
- # line and it is cleared so that all the contents of the line disappear from
- # the screen.
- #
- attr_accessor :overwrite
-
- #
- # Returns the provided _answer_string_ or the default answer for this
- # Question if a default was set and the answer is empty.
- #
- def answer_or_default( answer_string )
- if answer_string.length == 0 and not @default.nil?
- @default
- else
- answer_string
- end
- end
-
- #
- # Called late in the initialization process to build intelligent
- # responses based on the details of this Question object.
- #
- def build_responses( )
- ### WARNING: This code is quasi-duplicated in ###
- ### Menu.update_responses(). Check there too when ###
- ### making changes! ###
- append_default unless default.nil?
- @responses = { :ambiguous_completion =>
- "Ambiguous choice. " +
- "Please choose one of #{@answer_type.inspect}.",
- :ask_on_error =>
- "? ",
- :invalid_type =>
- "You must enter a valid #{@answer_type}.",
- :no_completion =>
- "You must choose one of " +
- "#{@answer_type.inspect}.",
- :not_in_range =>
- "Your answer isn't within the expected range " +
- "(#{expected_range}).",
- :not_valid =>
- "Your answer isn't valid (must match " +
- "#{@validate.inspect})." }.merge(@responses)
- ### WARNING: This code is quasi-duplicated in ###
- ### Menu.update_responses(). Check there too when ###
- ### making changes! ###
- end
-
- #
- # Returns the provided _answer_string_ after changing character case by
- # the rules of this Question. Valid settings for whitespace are:
- #
- # +nil+:: Do not alter character case.
- # (Default.)
- # :up:: Calls upcase().
- # :upcase:: Calls upcase().
- # :down:: Calls downcase().
- # :downcase:: Calls downcase().
- # :capitalize:: Calls capitalize().
- #
- # An unrecognized choice (like :none) is treated as +nil+.
- #
- def change_case( answer_string )
- if [:up, :upcase].include?(@case)
- answer_string.upcase
- elsif [:down, :downcase].include?(@case)
- answer_string.downcase
- elsif @case == :capitalize
- answer_string.capitalize
- else
- answer_string
- end
- end
-
- #
- # Transforms the given _answer_string_ into the expected type for this
- # Question. Currently supported conversions are:
- #
- # [...]:: Answer must be a member of the passed Array.
- # Auto-completion is used to expand partial
- # answers.
- # lambda {...}:: Answer is passed to lambda for conversion.
- # Date:: Date.parse() is called with answer.
- # DateTime:: DateTime.parse() is called with answer.
- # File:: The entered file name is auto-completed in
- # terms of _directory_ + _glob_, opened, and
- # returned.
- # Float:: Answer is converted with Kernel.Float().
- # Integer:: Answer is converted with Kernel.Integer().
- # +nil+:: Answer is left in String format. (Default.)
- # Pathname:: Same as File, save that a Pathname object is
- # returned.
- # String:: Answer is converted with Kernel.String().
- # Regexp:: Answer is fed to Regexp.new().
- # Symbol:: The method to_sym() is called on answer and
- # the result returned.
- # any other Class:: The answer is passed on to
- # Class.parse().
- #
- # This method throws ArgumentError, if the conversion cannot be
- # completed for any reason.
- #
- def convert( answer_string )
- if @answer_type.nil?
- answer_string
- elsif [Float, Integer, String].include?(@answer_type)
- Kernel.send(@answer_type.to_s.to_sym, answer_string)
- elsif @answer_type == Symbol
- answer_string.to_sym
- elsif @answer_type == Regexp
- Regexp.new(answer_string)
- elsif @answer_type.is_a?(Array) or [File, Pathname].include?(@answer_type)
- # cheating, using OptionParser's Completion module
- choices = selection
- choices.extend(OptionParser::Completion)
- answer = choices.complete(answer_string)
- if answer.nil?
- raise NoAutoCompleteMatch
- end
- if @answer_type.is_a?(Array)
- answer.last
- elsif @answer_type == File
- File.open(File.join(@directory.to_s, answer.last))
- else
- Pathname.new(File.join(@directory.to_s, answer.last))
- end
- elsif [Date, DateTime].include?(@answer_type) or @answer_type.is_a?(Class)
- @answer_type.parse(answer_string)
- elsif @answer_type.is_a?(Proc)
- @answer_type[answer_string]
- end
- end
-
- # Returns a english explination of the current range settings.
- def expected_range( )
- expected = [ ]
-
- expected << "above #{@above}" unless @above.nil?
- expected << "below #{@below}" unless @below.nil?
- expected << "included in #{@in.inspect}" unless @in.nil?
-
- case expected.size
- when 0 then ""
- when 1 then expected.first
- when 2 then expected.join(" and ")
- else expected[0..-2].join(", ") + ", and #{expected.last}"
- end
- end
-
- # Returns _first_answer_, which will be unset following this call.
- def first_answer( )
- @first_answer
- ensure
- @first_answer = nil
- end
-
- # Returns true if _first_answer_ is set.
- def first_answer?( )
- not @first_answer.nil?
- end
-
- #
- # Returns +true+ if the _answer_object_ is greater than the _above_
- # attribute, less than the _below_ attribute and included?()ed in the
- # _in_ attribute. Otherwise, +false+ is returned. Any +nil+ attributes
- # are not checked.
- #
- def in_range?( answer_object )
- (@above.nil? or answer_object > @above) and
- (@below.nil? or answer_object < @below) and
- (@in.nil? or @in.include?(answer_object))
- end
-
- #
- # Returns the provided _answer_string_ after processing whitespace by
- # the rules of this Question. Valid settings for whitespace are:
- #
- # +nil+:: Do not alter whitespace.
- # :strip:: Calls strip(). (Default.)
- # :chomp:: Calls chomp().
- # :collapse:: Collapses all whitspace runs to a
- # single space.
- # :strip_and_collapse:: Calls strip(), then collapses all
- # whitspace runs to a single space.
- # :chomp_and_collapse:: Calls chomp(), then collapses all
- # whitspace runs to a single space.
- # :remove:: Removes all whitespace.
- #
- # An unrecognized choice (like :none) is treated as +nil+.
- #
- # This process is skipped, for single character input.
- #
- def remove_whitespace( answer_string )
- if @whitespace.nil?
- answer_string
- elsif [:strip, :chomp].include?(@whitespace)
- answer_string.send(@whitespace)
- elsif @whitespace == :collapse
- answer_string.gsub(/\s+/, " ")
- elsif [:strip_and_collapse, :chomp_and_collapse].include?(@whitespace)
- result = answer_string.send(@whitespace.to_s[/^[a-z]+/])
- result.gsub(/\s+/, " ")
- elsif @whitespace == :remove
- answer_string.gsub(/\s+/, "")
- else
- answer_string
- end
- end
-
- #
- # Returns an Array of valid answers to this question. These answers are
- # only known when _answer_type_ is set to an Array of choices, File, or
- # Pathname. Any other time, this method will return an empty Array.
- #
- def selection( )
- if @answer_type.is_a?(Array)
- @answer_type
- elsif [File, Pathname].include?(@answer_type)
- Dir[File.join(@directory.to_s, @glob)].map do |file|
- File.basename(file)
- end
- else
- [ ]
- end
- end
-
- # Stringifies the question to be asked.
- def to_str( )
- @question
- end
-
- #
- # Returns +true+ if the provided _answer_string_ is accepted by the
- # _validate_ attribute or +false+ if it's not.
- #
- # It's important to realize that an answer is validated after whitespace
- # and case handling.
- #
- def valid_answer?( answer_string )
- @validate.nil? or
- (@validate.is_a?(Regexp) and answer_string =~ @validate) or
- (@validate.is_a?(Proc) and @validate[answer_string])
- end
-
- private
-
- #
- # Adds the default choice to the end of question between |...|.
- # Trailing whitespace is preserved so the function of HighLine.say() is
- # not affected.
- #
- def append_default( )
- if @question =~ /([\t ]+)\Z/
- @question << "|#{@default}|#{$1}"
- elsif @question == ""
- @question << "|#{@default}| "
- elsif @question[-1, 1] == "\n"
- @question[-2, 0] = " |#{@default}|"
- else
- @question << " |#{@default}|"
- end
- end
- end
-end
diff --git a/vendor/gems/highline-1.5.0/lib/highline/system_extensions.rb b/vendor/gems/highline-1.5.0/lib/highline/system_extensions.rb
deleted file mode 100644
index e08b4772..00000000
--- a/vendor/gems/highline-1.5.0/lib/highline/system_extensions.rb
+++ /dev/null
@@ -1,130 +0,0 @@
-#!/usr/local/bin/ruby -w
-
-# system_extensions.rb
-#
-# Created by James Edward Gray II on 2006-06-14.
-# Copyright 2006 Gray Productions. All rights reserved.
-#
-# This is Free Software. See LICENSE and COPYING for details.
-
-class HighLine
- module SystemExtensions
- module_function
-
- #
- # This section builds character reading and terminal size functions
- # to suit the proper platform we're running on. Be warned: Here be
- # dragons!
- #
- begin
- # Cygwin will look like Windows, but we want to treat it like a Posix OS:
- raise LoadError, "Cygwin is a Posix OS." if RUBY_PLATFORM =~ /\bcygwin\b/i
-
- require "Win32API" # See if we're on Windows.
-
- CHARACTER_MODE = "Win32API" # For Debugging purposes only.
-
- #
- # Windows savvy getc().
- #
- # *WARNING*: This method ignores input and reads one
- # character from +STDIN+!
- #
- def get_character( input = STDIN )
- Win32API.new("crtdll", "_getch", [ ], "L").Call
- end
-
- # A Windows savvy method to fetch the console columns, and rows.
- def terminal_size
- m_GetStdHandle = Win32API.new( 'kernel32',
- 'GetStdHandle',
- ['L'],
- 'L' )
- m_GetConsoleScreenBufferInfo = Win32API.new(
- 'kernel32', 'GetConsoleScreenBufferInfo', ['L', 'P'], 'L'
- )
-
- format = 'SSSSSssssSS'
- buf = ([0] * format.size).pack(format)
- stdout_handle = m_GetStdHandle.call(0xFFFFFFF5)
-
- m_GetConsoleScreenBufferInfo.call(stdout_handle, buf)
- bufx, bufy, curx, cury, wattr,
- left, top, right, bottom, maxx, maxy = buf.unpack(format)
- return right - left + 1, bottom - top + 1
- end
- rescue LoadError # If we're not on Windows try...
- begin
- require "termios" # Unix, first choice.
-
- CHARACTER_MODE = "termios" # For Debugging purposes only.
-
- #
- # Unix savvy getc(). (First choice.)
- #
- # *WARNING*: This method requires the "termios" library!
- #
- def get_character( input = STDIN )
- old_settings = Termios.getattr(input)
-
- new_settings = old_settings.dup
- new_settings.c_lflag &= ~(Termios::ECHO | Termios::ICANON)
- new_settings.c_cc[Termios::VMIN] = 1
-
- begin
- Termios.setattr(input, Termios::TCSANOW, new_settings)
- input.getc
- ensure
- Termios.setattr(input, Termios::TCSANOW, old_settings)
- end
- end
- rescue LoadError # If our first choice fails, default.
- CHARACTER_MODE = "stty" # For Debugging purposes only.
-
- #
- # Unix savvy getc(). (Second choice.)
- #
- # *WARNING*: This method requires the external "stty" program!
- #
- def get_character( input = STDIN )
- raw_no_echo_mode
-
- begin
- input.getc
- ensure
- restore_mode
- end
- end
-
- #
- # Switched the input mode to raw and disables echo.
- #
- # *WARNING*: This method requires the external "stty" program!
- #
- def raw_no_echo_mode
- @state = `stty -g`
- system "stty raw -echo cbreak isig"
- end
-
- #
- # Restores a previously saved input mode.
- #
- # *WARNING*: This method requires the external "stty" program!
- #
- def restore_mode
- system "stty #{@state}"
- end
- end
-
- # A Unix savvy method to fetch the console columns, and rows.
- def terminal_size
- if /solaris/ =~ RUBY_PLATFORM and
- `stty` =~ /\brows = (\d+).*\bcolumns = (\d+)/
- [$2, $1].map { |c| x.to_i }
- else
- `stty size`.split.map { |x| x.to_i }.reverse
- end
- end
- end
- end
-end
diff --git a/vendor/gems/highline-1.5.0/setup.rb b/vendor/gems/highline-1.5.0/setup.rb
deleted file mode 100644
index 0807023d..00000000
--- a/vendor/gems/highline-1.5.0/setup.rb
+++ /dev/null
@@ -1,1360 +0,0 @@
-#
-# setup.rb
-#
-# Copyright (c) 2000-2004 Minero Aoki
-#
-# This program is free software.
-# You can distribute/modify this program under the terms of
-# the GNU LGPL, Lesser General Public License version 2.1.
-#
-
-unless Enumerable.method_defined?(:map) # Ruby 1.4.6
- module Enumerable
- alias map collect
- end
-end
-
-unless File.respond_to?(:read) # Ruby 1.6
- def File.read(fname)
- open(fname) {|f|
- return f.read
- }
- end
-end
-
-def File.binread(fname)
- open(fname, 'rb') {|f|
- return f.read
- }
-end
-
-# for corrupted windows stat(2)
-def File.dir?(path)
- File.directory?((path[-1,1] == '/') ? path : path + '/')
-end
-
-
-class SetupError < StandardError; end
-
-def setup_rb_error(msg)
- raise SetupError, msg
-end
-
-#
-# Config
-#
-
-if arg = ARGV.detect {|arg| /\A--rbconfig=/ =~ arg }
- ARGV.delete(arg)
- require arg.split(/=/, 2)[1]
- $".push 'rbconfig.rb'
-else
- require 'rbconfig'
-end
-
-def multipackage_install?
- FileTest.directory?(File.dirname($0) + '/packages')
-end
-
-
-class ConfigItem
- def initialize(name, template, default, desc)
- @name = name.freeze
- @template = template
- @value = default
- @default = default.dup.freeze
- @description = desc
- end
-
- attr_reader :name
- attr_reader :description
-
- attr_accessor :default
- alias help_default default
-
- def help_opt
- "--#{@name}=#{@template}"
- end
-
- def value
- @value
- end
-
- def eval(table)
- @value.gsub(%r<\$([^/]+)>) { table[$1] }
- end
-
- def set(val)
- @value = check(val)
- end
-
- private
-
- def check(val)
- setup_rb_error "config: --#{name} requires argument" unless val
- val
- end
-end
-
-class BoolItem < ConfigItem
- def config_type
- 'bool'
- end
-
- def help_opt
- "--#{@name}"
- end
-
- private
-
- def check(val)
- return 'yes' unless val
- unless /\A(y(es)?|n(o)?|t(rue)?|f(alse))\z/i =~ val
- setup_rb_error "config: --#{@name} accepts only yes/no for argument"
- end
- (/\Ay(es)?|\At(rue)/i =~ value) ? 'yes' : 'no'
- end
-end
-
-class PathItem < ConfigItem
- def config_type
- 'path'
- end
-
- private
-
- def check(path)
- setup_rb_error "config: --#{@name} requires argument" unless path
- path[0,1] == '$' ? path : File.expand_path(path)
- end
-end
-
-class ProgramItem < ConfigItem
- def config_type
- 'program'
- end
-end
-
-class SelectItem < ConfigItem
- def initialize(name, template, default, desc)
- super
- @ok = template.split('/')
- end
-
- def config_type
- 'select'
- end
-
- private
-
- def check(val)
- unless @ok.include?(val.strip)
- setup_rb_error "config: use --#{@name}=#{@template} (#{val})"
- end
- val.strip
- end
-end
-
-class PackageSelectionItem < ConfigItem
- def initialize(name, template, default, help_default, desc)
- super name, template, default, desc
- @help_default = help_default
- end
-
- attr_reader :help_default
-
- def config_type
- 'package'
- end
-
- private
-
- def check(val)
- unless File.dir?("packages/#{val}")
- setup_rb_error "config: no such package: #{val}"
- end
- val
- end
-end
-
-class ConfigTable_class
-
- def initialize(items)
- @items = items
- @table = {}
- items.each do |i|
- @table[i.name] = i
- end
- ALIASES.each do |ali, name|
- @table[ali] = @table[name]
- end
- end
-
- include Enumerable
-
- def each(&block)
- @items.each(&block)
- end
-
- def key?(name)
- @table.key?(name)
- end
-
- def lookup(name)
- @table[name] or raise ArgumentError, "no such config item: #{name}"
- end
-
- def add(item)
- @items.push item
- @table[item.name] = item
- end
-
- def remove(name)
- item = lookup(name)
- @items.delete_if {|i| i.name == name }
- @table.delete_if {|name, i| i.name == name }
- item
- end
-
- def new
- dup()
- end
-
- def savefile
- '.config'
- end
-
- def load
- begin
- t = dup()
- File.foreach(savefile()) do |line|
- k, v = *line.split(/=/, 2)
- t[k] = v.strip
- end
- t
- rescue Errno::ENOENT
- setup_rb_error $!.message + "#{File.basename($0)} config first"
- end
- end
-
- def save
- @items.each {|i| i.value }
- File.open(savefile(), 'w') {|f|
- @items.each do |i|
- f.printf "%s=%s\n", i.name, i.value if i.value
- end
- }
- end
-
- def [](key)
- lookup(key).eval(self)
- end
-
- def []=(key, val)
- lookup(key).set val
- end
-
-end
-
-c = ::Config::CONFIG
-
-rubypath = c['bindir'] + '/' + c['ruby_install_name']
-
-major = c['MAJOR'].to_i
-minor = c['MINOR'].to_i
-teeny = c['TEENY'].to_i
-version = "#{major}.#{minor}"
-
-# ruby ver. >= 1.4.4?
-newpath_p = ((major >= 2) or
- ((major == 1) and
- ((minor >= 5) or
- ((minor == 4) and (teeny >= 4)))))
-
-if c['rubylibdir']
- # V < 1.6.3
- _stdruby = c['rubylibdir']
- _siteruby = c['sitedir']
- _siterubyver = c['sitelibdir']
- _siterubyverarch = c['sitearchdir']
-elsif newpath_p
- # 1.4.4 <= V <= 1.6.3
- _stdruby = "$prefix/lib/ruby/#{version}"
- _siteruby = c['sitedir']
- _siterubyver = "$siteruby/#{version}"
- _siterubyverarch = "$siterubyver/#{c['arch']}"
-else
- # V < 1.4.4
- _stdruby = "$prefix/lib/ruby/#{version}"
- _siteruby = "$prefix/lib/ruby/#{version}/site_ruby"
- _siterubyver = _siteruby
- _siterubyverarch = "$siterubyver/#{c['arch']}"
-end
-libdir = '-* dummy libdir *-'
-stdruby = '-* dummy rubylibdir *-'
-siteruby = '-* dummy site_ruby *-'
-siterubyver = '-* dummy site_ruby version *-'
-parameterize = lambda {|path|
- path.sub(/\A#{Regexp.quote(c['prefix'])}/, '$prefix')\
- .sub(/\A#{Regexp.quote(libdir)}/, '$libdir')\
- .sub(/\A#{Regexp.quote(stdruby)}/, '$stdruby')\
- .sub(/\A#{Regexp.quote(siteruby)}/, '$siteruby')\
- .sub(/\A#{Regexp.quote(siterubyver)}/, '$siterubyver')
-}
-libdir = parameterize.call(c['libdir'])
-stdruby = parameterize.call(_stdruby)
-siteruby = parameterize.call(_siteruby)
-siterubyver = parameterize.call(_siterubyver)
-siterubyverarch = parameterize.call(_siterubyverarch)
-
-if arg = c['configure_args'].split.detect {|arg| /--with-make-prog=/ =~ arg }
- makeprog = arg.sub(/'/, '').split(/=/, 2)[1]
-else
- makeprog = 'make'
-end
-
-common_conf = [
- PathItem.new('prefix', 'path', c['prefix'],
- 'path prefix of target environment'),
- PathItem.new('bindir', 'path', parameterize.call(c['bindir']),
- 'the directory for commands'),
- PathItem.new('libdir', 'path', libdir,
- 'the directory for libraries'),
- PathItem.new('datadir', 'path', parameterize.call(c['datadir']),
- 'the directory for shared data'),
- PathItem.new('mandir', 'path', parameterize.call(c['mandir']),
- 'the directory for man pages'),
- PathItem.new('sysconfdir', 'path', parameterize.call(c['sysconfdir']),
- 'the directory for man pages'),
- PathItem.new('stdruby', 'path', stdruby,
- 'the directory for standard ruby libraries'),
- PathItem.new('siteruby', 'path', siteruby,
- 'the directory for version-independent aux ruby libraries'),
- PathItem.new('siterubyver', 'path', siterubyver,
- 'the directory for aux ruby libraries'),
- PathItem.new('siterubyverarch', 'path', siterubyverarch,
- 'the directory for aux ruby binaries'),
- PathItem.new('rbdir', 'path', '$siterubyver',
- 'the directory for ruby scripts'),
- PathItem.new('sodir', 'path', '$siterubyverarch',
- 'the directory for ruby extentions'),
- PathItem.new('rubypath', 'path', rubypath,
- 'the path to set to #! line'),
- ProgramItem.new('rubyprog', 'name', rubypath,
- 'the ruby program using for installation'),
- ProgramItem.new('makeprog', 'name', makeprog,
- 'the make program to compile ruby extentions'),
- SelectItem.new('shebang', 'all/ruby/never', 'ruby',
- 'shebang line (#!) editing mode'),
- BoolItem.new('without-ext', 'yes/no', 'no',
- 'does not compile/install ruby extentions')
-]
-class ConfigTable_class # open again
- ALIASES = {
- 'std-ruby' => 'stdruby',
- 'site-ruby-common' => 'siteruby', # For backward compatibility
- 'site-ruby' => 'siterubyver', # For backward compatibility
- 'bin-dir' => 'bindir',
- 'bin-dir' => 'bindir',
- 'rb-dir' => 'rbdir',
- 'so-dir' => 'sodir',
- 'data-dir' => 'datadir',
- 'ruby-path' => 'rubypath',
- 'ruby-prog' => 'rubyprog',
- 'ruby' => 'rubyprog',
- 'make-prog' => 'makeprog',
- 'make' => 'makeprog'
- }
-end
-multipackage_conf = [
- PackageSelectionItem.new('with', 'name,name...', '', 'ALL',
- 'package names that you want to install'),
- PackageSelectionItem.new('without', 'name,name...', '', 'NONE',
- 'package names that you do not want to install')
-]
-if multipackage_install?
- ConfigTable = ConfigTable_class.new(common_conf + multipackage_conf)
-else
- ConfigTable = ConfigTable_class.new(common_conf)
-end
-
-
-module MetaConfigAPI
-
- def eval_file_ifexist(fname)
- instance_eval File.read(fname), fname, 1 if File.file?(fname)
- end
-
- def config_names
- ConfigTable.map {|i| i.name }
- end
-
- def config?(name)
- ConfigTable.key?(name)
- end
-
- def bool_config?(name)
- ConfigTable.lookup(name).config_type == 'bool'
- end
-
- def path_config?(name)
- ConfigTable.lookup(name).config_type == 'path'
- end
-
- def value_config?(name)
- case ConfigTable.lookup(name).config_type
- when 'bool', 'path'
- true
- else
- false
- end
- end
-
- def add_config(item)
- ConfigTable.add item
- end
-
- def add_bool_config(name, default, desc)
- ConfigTable.add BoolItem.new(name, 'yes/no', default ? 'yes' : 'no', desc)
- end
-
- def add_path_config(name, default, desc)
- ConfigTable.add PathItem.new(name, 'path', default, desc)
- end
-
- def set_config_default(name, default)
- ConfigTable.lookup(name).default = default
- end
-
- def remove_config(name)
- ConfigTable.remove(name)
- end
-
-end
-
-
-#
-# File Operations
-#
-
-module FileOperations
-
- def mkdir_p(dirname, prefix = nil)
- dirname = prefix + File.expand_path(dirname) if prefix
- $stderr.puts "mkdir -p #{dirname}" if verbose?
- return if no_harm?
-
- # does not check '/'... it's too abnormal case
- dirs = File.expand_path(dirname).split(%r<(?=/)>)
- if /\A[a-z]:\z/i =~ dirs[0]
- disk = dirs.shift
- dirs[0] = disk + dirs[0]
- end
- dirs.each_index do |idx|
- path = dirs[0..idx].join('')
- Dir.mkdir path unless File.dir?(path)
- end
- end
-
- def rm_f(fname)
- $stderr.puts "rm -f #{fname}" if verbose?
- return if no_harm?
-
- if File.exist?(fname) or File.symlink?(fname)
- File.chmod 0777, fname
- File.unlink fname
- end
- end
-
- def rm_rf(dn)
- $stderr.puts "rm -rf #{dn}" if verbose?
- return if no_harm?
-
- Dir.chdir dn
- Dir.foreach('.') do |fn|
- next if fn == '.'
- next if fn == '..'
- if File.dir?(fn)
- verbose_off {
- rm_rf fn
- }
- else
- verbose_off {
- rm_f fn
- }
- end
- end
- Dir.chdir '..'
- Dir.rmdir dn
- end
-
- def move_file(src, dest)
- File.unlink dest if File.exist?(dest)
- begin
- File.rename src, dest
- rescue
- File.open(dest, 'wb') {|f| f.write File.binread(src) }
- File.chmod File.stat(src).mode, dest
- File.unlink src
- end
- end
-
- def install(from, dest, mode, prefix = nil)
- $stderr.puts "install #{from} #{dest}" if verbose?
- return if no_harm?
-
- realdest = prefix ? prefix + File.expand_path(dest) : dest
- realdest = File.join(realdest, File.basename(from)) if File.dir?(realdest)
- str = File.binread(from)
- if diff?(str, realdest)
- verbose_off {
- rm_f realdest if File.exist?(realdest)
- }
- File.open(realdest, 'wb') {|f|
- f.write str
- }
- File.chmod mode, realdest
-
- File.open("#{objdir_root()}/InstalledFiles", 'a') {|f|
- if prefix
- f.puts realdest.sub(prefix, '')
- else
- f.puts realdest
- end
- }
- end
- end
-
- def diff?(new_content, path)
- return true unless File.exist?(path)
- new_content != File.binread(path)
- end
-
- def command(str)
- $stderr.puts str if verbose?
- system str or raise RuntimeError, "'system #{str}' failed"
- end
-
- def ruby(str)
- command config('rubyprog') + ' ' + str
- end
-
- def make(task = '')
- command config('makeprog') + ' ' + task
- end
-
- def extdir?(dir)
- File.exist?(dir + '/MANIFEST')
- end
-
- def all_files_in(dirname)
- Dir.open(dirname) {|d|
- return d.select {|ent| File.file?("#{dirname}/#{ent}") }
- }
- end
-
- REJECT_DIRS = %w(
- CVS SCCS RCS CVS.adm .svn
- )
-
- def all_dirs_in(dirname)
- Dir.open(dirname) {|d|
- return d.select {|n| File.dir?("#{dirname}/#{n}") } - %w(. ..) - REJECT_DIRS
- }
- end
-
-end
-
-
-#
-# Main Installer
-#
-
-module HookUtils
-
- def run_hook(name)
- try_run_hook "#{curr_srcdir()}/#{name}" or
- try_run_hook "#{curr_srcdir()}/#{name}.rb"
- end
-
- def try_run_hook(fname)
- return false unless File.file?(fname)
- begin
- instance_eval File.read(fname), fname, 1
- rescue
- setup_rb_error "hook #{fname} failed:\n" + $!.message
- end
- true
- end
-
-end
-
-
-module HookScriptAPI
-
- def get_config(key)
- @config[key]
- end
-
- alias config get_config
-
- def set_config(key, val)
- @config[key] = val
- end
-
- #
- # srcdir/objdir (works only in the package directory)
- #
-
- #abstract srcdir_root
- #abstract objdir_root
- #abstract relpath
-
- def curr_srcdir
- "#{srcdir_root()}/#{relpath()}"
- end
-
- def curr_objdir
- "#{objdir_root()}/#{relpath()}"
- end
-
- def srcfile(path)
- "#{curr_srcdir()}/#{path}"
- end
-
- def srcexist?(path)
- File.exist?(srcfile(path))
- end
-
- def srcdirectory?(path)
- File.dir?(srcfile(path))
- end
-
- def srcfile?(path)
- File.file? srcfile(path)
- end
-
- def srcentries(path = '.')
- Dir.open("#{curr_srcdir()}/#{path}") {|d|
- return d.to_a - %w(. ..)
- }
- end
-
- def srcfiles(path = '.')
- srcentries(path).select {|fname|
- File.file?(File.join(curr_srcdir(), path, fname))
- }
- end
-
- def srcdirectories(path = '.')
- srcentries(path).select {|fname|
- File.dir?(File.join(curr_srcdir(), path, fname))
- }
- end
-
-end
-
-
-class ToplevelInstaller
-
- Version = '3.3.1'
- Copyright = 'Copyright (c) 2000-2004 Minero Aoki'
-
- TASKS = [
- [ 'all', 'do config, setup, then install' ],
- [ 'config', 'saves your configurations' ],
- [ 'show', 'shows current configuration' ],
- [ 'setup', 'compiles ruby extentions and others' ],
- [ 'install', 'installs files' ],
- [ 'clean', "does `make clean' for each extention" ],
- [ 'distclean',"does `make distclean' for each extention" ]
- ]
-
- def ToplevelInstaller.invoke
- instance().invoke
- end
-
- @singleton = nil
-
- def ToplevelInstaller.instance
- @singleton ||= new(File.dirname($0))
- @singleton
- end
-
- include MetaConfigAPI
-
- def initialize(ardir_root)
- @config = nil
- @options = { 'verbose' => true }
- @ardir = File.expand_path(ardir_root)
- end
-
- def inspect
- "#<#{self.class} #{__id__()}>"
- end
-
- def invoke
- run_metaconfigs
- case task = parsearg_global()
- when nil, 'all'
- @config = load_config('config')
- parsearg_config
- init_installers
- exec_config
- exec_setup
- exec_install
- else
- @config = load_config(task)
- __send__ "parsearg_#{task}"
- init_installers
- __send__ "exec_#{task}"
- end
- end
-
- def run_metaconfigs
- eval_file_ifexist "#{@ardir}/metaconfig"
- end
-
- def load_config(task)
- case task
- when 'config'
- ConfigTable.new
- when 'clean', 'distclean'
- if File.exist?(ConfigTable.savefile)
- then ConfigTable.load
- else ConfigTable.new
- end
- else
- ConfigTable.load
- end
- end
-
- def init_installers
- @installer = Installer.new(@config, @options, @ardir, File.expand_path('.'))
- end
-
- #
- # Hook Script API bases
- #
-
- def srcdir_root
- @ardir
- end
-
- def objdir_root
- '.'
- end
-
- def relpath
- '.'
- end
-
- #
- # Option Parsing
- #
-
- def parsearg_global
- valid_task = /\A(?:#{TASKS.map {|task,desc| task }.join '|'})\z/
-
- while arg = ARGV.shift
- case arg
- when /\A\w+\z/
- setup_rb_error "invalid task: #{arg}" unless valid_task =~ arg
- return arg
-
- when '-q', '--quiet'
- @options['verbose'] = false
-
- when '--verbose'
- @options['verbose'] = true
-
- when '-h', '--help'
- print_usage $stdout
- exit 0
-
- when '-v', '--version'
- puts "#{File.basename($0)} version #{Version}"
- exit 0
-
- when '--copyright'
- puts Copyright
- exit 0
-
- else
- setup_rb_error "unknown global option '#{arg}'"
- end
- end
-
- nil
- end
-
-
- def parsearg_no_options
- unless ARGV.empty?
- setup_rb_error "#{task}: unknown options: #{ARGV.join ' '}"
- end
- end
-
- alias parsearg_show parsearg_no_options
- alias parsearg_setup parsearg_no_options
- alias parsearg_clean parsearg_no_options
- alias parsearg_distclean parsearg_no_options
-
- def parsearg_config
- re = /\A--(#{ConfigTable.map {|i| i.name }.join('|')})(?:=(.*))?\z/
- @options['config-opt'] = []
-
- while i = ARGV.shift
- if /\A--?\z/ =~ i
- @options['config-opt'] = ARGV.dup
- break
- end
- m = re.match(i) or setup_rb_error "config: unknown option #{i}"
- name, value = *m.to_a[1,2]
- @config[name] = value
- end
- end
-
- def parsearg_install
- @options['no-harm'] = false
- @options['install-prefix'] = ''
- while a = ARGV.shift
- case a
- when /\A--no-harm\z/
- @options['no-harm'] = true
- when /\A--prefix=(.*)\z/
- path = $1
- path = File.expand_path(path) unless path[0,1] == '/'
- @options['install-prefix'] = path
- else
- setup_rb_error "install: unknown option #{a}"
- end
- end
- end
-
- def print_usage(out)
- out.puts 'Typical Installation Procedure:'
- out.puts " $ ruby #{File.basename $0} config"
- out.puts " $ ruby #{File.basename $0} setup"
- out.puts " # ruby #{File.basename $0} install (may require root privilege)"
- out.puts
- out.puts 'Detailed Usage:'
- out.puts " ruby #{File.basename $0} "
- out.puts " ruby #{File.basename $0} [] []"
-
- fmt = " %-24s %s\n"
- out.puts
- out.puts 'Global options:'
- out.printf fmt, '-q,--quiet', 'suppress message outputs'
- out.printf fmt, ' --verbose', 'output messages verbosely'
- out.printf fmt, '-h,--help', 'print this message'
- out.printf fmt, '-v,--version', 'print version and quit'
- out.printf fmt, ' --copyright', 'print copyright and quit'
- out.puts
- out.puts 'Tasks:'
- TASKS.each do |name, desc|
- out.printf fmt, name, desc
- end
-
- fmt = " %-24s %s [%s]\n"
- out.puts
- out.puts 'Options for CONFIG or ALL:'
- ConfigTable.each do |item|
- out.printf fmt, item.help_opt, item.description, item.help_default
- end
- out.printf fmt, '--rbconfig=path', 'rbconfig.rb to load',"running ruby's"
- out.puts
- out.puts 'Options for INSTALL:'
- out.printf fmt, '--no-harm', 'only display what to do if given', 'off'
- out.printf fmt, '--prefix=path', 'install path prefix', '$prefix'
- out.puts
- end
-
- #
- # Task Handlers
- #
-
- def exec_config
- @installer.exec_config
- @config.save # must be final
- end
-
- def exec_setup
- @installer.exec_setup
- end
-
- def exec_install
- @installer.exec_install
- end
-
- def exec_show
- ConfigTable.each do |i|
- printf "%-20s %s\n", i.name, i.value
- end
- end
-
- def exec_clean
- @installer.exec_clean
- end
-
- def exec_distclean
- @installer.exec_distclean
- end
-
-end
-
-
-class ToplevelInstallerMulti < ToplevelInstaller
-
- include HookUtils
- include HookScriptAPI
- include FileOperations
-
- def initialize(ardir)
- super
- @packages = all_dirs_in("#{@ardir}/packages")
- raise 'no package exists' if @packages.empty?
- end
-
- def run_metaconfigs
- eval_file_ifexist "#{@ardir}/metaconfig"
- @packages.each do |name|
- eval_file_ifexist "#{@ardir}/packages/#{name}/metaconfig"
- end
- end
-
- def init_installers
- @installers = {}
- @packages.each do |pack|
- @installers[pack] = Installer.new(@config, @options,
- "#{@ardir}/packages/#{pack}",
- "packages/#{pack}")
- end
-
- with = extract_selection(config('with'))
- without = extract_selection(config('without'))
- @selected = @installers.keys.select {|name|
- (with.empty? or with.include?(name)) \
- and not without.include?(name)
- }
- end
-
- def extract_selection(list)
- a = list.split(/,/)
- a.each do |name|
- setup_rb_error "no such package: #{name}" unless @installers.key?(name)
- end
- a
- end
-
- def print_usage(f)
- super
- f.puts 'Inluded packages:'
- f.puts ' ' + @packages.sort.join(' ')
- f.puts
- end
-
- #
- # multi-package metaconfig API
- #
-
- attr_reader :packages
-
- def declare_packages(list)
- raise 'package list is empty' if list.empty?
- list.each do |name|
- raise "directory packages/#{name} does not exist"\
- unless File.dir?("#{@ardir}/packages/#{name}")
- end
- @packages = list
- end
-
- #
- # Task Handlers
- #
-
- def exec_config
- run_hook 'pre-config'
- each_selected_installers {|inst| inst.exec_config }
- run_hook 'post-config'
- @config.save # must be final
- end
-
- def exec_setup
- run_hook 'pre-setup'
- each_selected_installers {|inst| inst.exec_setup }
- run_hook 'post-setup'
- end
-
- def exec_install
- run_hook 'pre-install'
- each_selected_installers {|inst| inst.exec_install }
- run_hook 'post-install'
- end
-
- def exec_clean
- rm_f ConfigTable.savefile
- run_hook 'pre-clean'
- each_selected_installers {|inst| inst.exec_clean }
- run_hook 'post-clean'
- end
-
- def exec_distclean
- rm_f ConfigTable.savefile
- run_hook 'pre-distclean'
- each_selected_installers {|inst| inst.exec_distclean }
- run_hook 'post-distclean'
- end
-
- #
- # lib
- #
-
- def each_selected_installers
- Dir.mkdir 'packages' unless File.dir?('packages')
- @selected.each do |pack|
- $stderr.puts "Processing the package `#{pack}' ..." if @options['verbose']
- Dir.mkdir "packages/#{pack}" unless File.dir?("packages/#{pack}")
- Dir.chdir "packages/#{pack}"
- yield @installers[pack]
- Dir.chdir '../..'
- end
- end
-
- def verbose?
- @options['verbose']
- end
-
- def no_harm?
- @options['no-harm']
- end
-
-end
-
-
-class Installer
-
- FILETYPES = %w( bin lib ext data )
-
- include HookScriptAPI
- include HookUtils
- include FileOperations
-
- def initialize(config, opt, srcroot, objroot)
- @config = config
- @options = opt
- @srcdir = File.expand_path(srcroot)
- @objdir = File.expand_path(objroot)
- @currdir = '.'
- end
-
- def inspect
- "#<#{self.class} #{File.basename(@srcdir)}>"
- end
-
- #
- # Hook Script API base methods
- #
-
- def srcdir_root
- @srcdir
- end
-
- def objdir_root
- @objdir
- end
-
- def relpath
- @currdir
- end
-
- #
- # configs/options
- #
-
- def no_harm?
- @options['no-harm']
- end
-
- def verbose?
- @options['verbose']
- end
-
- def verbose_off
- begin
- save, @options['verbose'] = @options['verbose'], false
- yield
- ensure
- @options['verbose'] = save
- end
- end
-
- #
- # TASK config
- #
-
- def exec_config
- exec_task_traverse 'config'
- end
-
- def config_dir_bin(rel)
- end
-
- def config_dir_lib(rel)
- end
-
- def config_dir_ext(rel)
- extconf if extdir?(curr_srcdir())
- end
-
- def extconf
- opt = @options['config-opt'].join(' ')
- command "#{config('rubyprog')} #{curr_srcdir()}/extconf.rb #{opt}"
- end
-
- def config_dir_data(rel)
- end
-
- #
- # TASK setup
- #
-
- def exec_setup
- exec_task_traverse 'setup'
- end
-
- def setup_dir_bin(rel)
- all_files_in(curr_srcdir()).each do |fname|
- adjust_shebang "#{curr_srcdir()}/#{fname}"
- end
- end
-
- def adjust_shebang(path)
- return if no_harm?
- tmpfile = File.basename(path) + '.tmp'
- begin
- File.open(path, 'rb') {|r|
- first = r.gets
- return unless File.basename(config('rubypath')) == 'ruby'
- return unless File.basename(first.sub(/\A\#!/, '').split[0]) == 'ruby'
- $stderr.puts "adjusting shebang: #{File.basename(path)}" if verbose?
- File.open(tmpfile, 'wb') {|w|
- w.print first.sub(/\A\#!\s*\S+/, '#! ' + config('rubypath'))
- w.write r.read
- }
- move_file tmpfile, File.basename(path)
- }
- ensure
- File.unlink tmpfile if File.exist?(tmpfile)
- end
- end
-
- def setup_dir_lib(rel)
- end
-
- def setup_dir_ext(rel)
- make if extdir?(curr_srcdir())
- end
-
- def setup_dir_data(rel)
- end
-
- #
- # TASK install
- #
-
- def exec_install
- rm_f 'InstalledFiles'
- exec_task_traverse 'install'
- end
-
- def install_dir_bin(rel)
- install_files collect_filenames_auto(), "#{config('bindir')}/#{rel}", 0755
- end
-
- def install_dir_lib(rel)
- install_files ruby_scripts(), "#{config('rbdir')}/#{rel}", 0644
- end
-
- def install_dir_ext(rel)
- return unless extdir?(curr_srcdir())
- install_files ruby_extentions('.'),
- "#{config('sodir')}/#{File.dirname(rel)}",
- 0555
- end
-
- def install_dir_data(rel)
- install_files collect_filenames_auto(), "#{config('datadir')}/#{rel}", 0644
- end
-
- def install_files(list, dest, mode)
- mkdir_p dest, @options['install-prefix']
- list.each do |fname|
- install fname, dest, mode, @options['install-prefix']
- end
- end
-
- def ruby_scripts
- collect_filenames_auto().select {|n| /\.rb\z/ =~ n }
- end
-
- # picked up many entries from cvs-1.11.1/src/ignore.c
- reject_patterns = %w(
- core RCSLOG tags TAGS .make.state
- .nse_depinfo #* .#* cvslog.* ,* .del-* *.olb
- *~ *.old *.bak *.BAK *.orig *.rej _$* *$
-
- *.org *.in .*
- )
- mapping = {
- '.' => '\.',
- '$' => '\$',
- '#' => '\#',
- '*' => '.*'
- }
- REJECT_PATTERNS = Regexp.new('\A(?:' +
- reject_patterns.map {|pat|
- pat.gsub(/[\.\$\#\*]/) {|ch| mapping[ch] }
- }.join('|') +
- ')\z')
-
- def collect_filenames_auto
- mapdir((existfiles() - hookfiles()).reject {|fname|
- REJECT_PATTERNS =~ fname
- })
- end
-
- def existfiles
- all_files_in(curr_srcdir()) | all_files_in('.')
- end
-
- def hookfiles
- %w( pre-%s post-%s pre-%s.rb post-%s.rb ).map {|fmt|
- %w( config setup install clean ).map {|t| sprintf(fmt, t) }
- }.flatten
- end
-
- def mapdir(filelist)
- filelist.map {|fname|
- if File.exist?(fname) # objdir
- fname
- else # srcdir
- File.join(curr_srcdir(), fname)
- end
- }
- end
-
- def ruby_extentions(dir)
- Dir.open(dir) {|d|
- ents = d.select {|fname| /\.#{::Config::CONFIG['DLEXT']}\z/ =~ fname }
- if ents.empty?
- setup_rb_error "no ruby extention exists: 'ruby #{$0} setup' first"
- end
- return ents
- }
- end
-
- #
- # TASK clean
- #
-
- def exec_clean
- exec_task_traverse 'clean'
- rm_f ConfigTable.savefile
- rm_f 'InstalledFiles'
- end
-
- def clean_dir_bin(rel)
- end
-
- def clean_dir_lib(rel)
- end
-
- def clean_dir_ext(rel)
- return unless extdir?(curr_srcdir())
- make 'clean' if File.file?('Makefile')
- end
-
- def clean_dir_data(rel)
- end
-
- #
- # TASK distclean
- #
-
- def exec_distclean
- exec_task_traverse 'distclean'
- rm_f ConfigTable.savefile
- rm_f 'InstalledFiles'
- end
-
- def distclean_dir_bin(rel)
- end
-
- def distclean_dir_lib(rel)
- end
-
- def distclean_dir_ext(rel)
- return unless extdir?(curr_srcdir())
- make 'distclean' if File.file?('Makefile')
- end
-
- #
- # lib
- #
-
- def exec_task_traverse(task)
- run_hook "pre-#{task}"
- FILETYPES.each do |type|
- if config('without-ext') == 'yes' and type == 'ext'
- $stderr.puts 'skipping ext/* by user option' if verbose?
- next
- end
- traverse task, type, "#{task}_dir_#{type}"
- end
- run_hook "post-#{task}"
- end
-
- def traverse(task, rel, mid)
- dive_into(rel) {
- run_hook "pre-#{task}"
- __send__ mid, rel.sub(%r[\A.*?(?:/|\z)], '')
- all_dirs_in(curr_srcdir()).each do |d|
- traverse task, "#{rel}/#{d}", mid
- end
- run_hook "post-#{task}"
- }
- end
-
- def dive_into(rel)
- return unless File.dir?("#{@srcdir}/#{rel}")
-
- dir = File.basename(rel)
- Dir.mkdir dir unless File.dir?(dir)
- prevdir = Dir.pwd
- Dir.chdir dir
- $stderr.puts '---> ' + rel if verbose?
- @currdir = rel
- yield
- Dir.chdir prevdir
- $stderr.puts '<--- ' + rel if verbose?
- @currdir = File.dirname(rel)
- end
-
-end
-
-
-if $0 == __FILE__
- begin
- if multipackage_install?
- ToplevelInstallerMulti.invoke
- else
- ToplevelInstaller.invoke
- end
- rescue SetupError
- raise if $DEBUG
- $stderr.puts $!.message
- $stderr.puts "Try 'ruby #{$0} --help' for detailed usage."
- exit 1
- end
-end
diff --git a/vendor/gems/highline-1.5.0/test/tc_color_scheme.rb b/vendor/gems/highline-1.5.0/test/tc_color_scheme.rb
deleted file mode 100644
index cb5cbd0e..00000000
--- a/vendor/gems/highline-1.5.0/test/tc_color_scheme.rb
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/usr/local/bin/ruby -w
-
-# tc_color_scheme.rb
-#
-# Created by Jeremy Hinegardner on 2007-01-24.
-# Copyright 2007 Jeremy Hinegardner. All rights reserved.
-#
-# This is Free Software. See LICENSE and COPYING for details.
-
-require "test/unit"
-
-require "highline"
-require "stringio"
-
-class TestColorScheme < Test::Unit::TestCase
- def setup
- @input = StringIO.new
- @output = StringIO.new
- @terminal = HighLine.new(@input, @output)
-
- @old_color_scheme = HighLine.color_scheme
- end
-
- def teardown
- HighLine.color_scheme = @old_color_scheme
- end
-
- def test_using_color_scheme
- assert_equal(false,HighLine.using_color_scheme?)
-
- HighLine.color_scheme = HighLine::ColorScheme.new
- assert_equal(true,HighLine.using_color_scheme?)
- end
-
- def test_scheme
- HighLine.color_scheme = HighLine::SampleColorScheme.new
-
- @terminal.say("This should be <%= color('warning yellow', :warning) %>.")
- assert_equal("This should be \e[1m\e[33mwarning yellow\e[0m.\n",@output.string)
- @output.rewind
-
- @terminal.say("This should be <%= color('warning yellow', 'warning') %>.")
- assert_equal("This should be \e[1m\e[33mwarning yellow\e[0m.\n",@output.string)
- @output.rewind
-
- @terminal.say("This should be <%= color('warning yellow', 'WarNing') %>.")
- assert_equal("This should be \e[1m\e[33mwarning yellow\e[0m.\n",@output.string)
- @output.rewind
-
- # turn it back off, should raise an exception
- HighLine.color_scheme = @old_color_scheme
- assert_raises(NameError) {
- @terminal.say("This should be <%= color('nothing at all', :error) %>.")
- }
- end
-end
diff --git a/vendor/gems/highline-1.5.0/test/tc_highline.rb b/vendor/gems/highline-1.5.0/test/tc_highline.rb
deleted file mode 100644
index bbb8354e..00000000
--- a/vendor/gems/highline-1.5.0/test/tc_highline.rb
+++ /dev/null
@@ -1,823 +0,0 @@
-#!/usr/local/bin/ruby -w
-
-# tc_highline.rb
-#
-# Created by James Edward Gray II on 2005-04-26.
-# Copyright 2005 Gray Productions. All rights reserved.
-#
-# This is Free Software. See LICENSE and COPYING for details.
-
-require "test/unit"
-
-require "highline"
-require "stringio"
-
-if HighLine::CHARACTER_MODE == "Win32API"
- class HighLine
- # Override Windows' character reading so it's not tied to STDIN.
- def get_character( input = STDIN )
- input.getc
- end
- end
-end
-
-class TestHighLine < Test::Unit::TestCase
- def setup
- @input = StringIO.new
- @output = StringIO.new
- @terminal = HighLine.new(@input, @output)
- end
-
- def test_agree
- @input << "y\nyes\nYES\nHell no!\nNo\n"
- @input.rewind
-
- assert_equal(true, @terminal.agree("Yes or no? "))
- assert_equal(true, @terminal.agree("Yes or no? "))
- assert_equal(true, @terminal.agree("Yes or no? "))
- assert_equal(false, @terminal.agree("Yes or no? "))
-
- @input.truncate(@input.rewind)
- @input << "yellow"
- @input.rewind
-
- assert_equal(true, @terminal.agree("Yes or no? ", :getc))
- end
-
- def test_agree_with_block
- @input << "\n\n"
- @input.rewind
-
- assert_equal(true, @terminal.agree("Yes or no? ") { |q| q.default = "y" })
- assert_equal(false, @terminal.agree("Yes or no? ") { |q| q.default = "n" })
- end
-
- def test_ask
- name = "James Edward Gray II"
- @input << name << "\n"
- @input.rewind
-
- assert_equal(name, @terminal.ask("What is your name? "))
-
- assert_raise(EOFError) { @terminal.ask("Any input left? ") }
- end
-
- def test_bug_fixes
- # auto-complete bug
- @input << "ruby\nRuby\n"
- @input.rewind
-
- languages = [:Perl, :Python, :Ruby]
- answer = @terminal.ask( "What is your favorite programming language? ",
- languages )
- assert_equal(languages.last, answer)
-
- @input.truncate(@input.rewind)
- @input << "ruby\n"
- @input.rewind
-
- answer = @terminal.ask( "What is your favorite programming language? ",
- languages ) do |q|
- q.case = :capitalize
- end
- assert_equal(languages.last, answer)
-
- # poor auto-complete error message
- @input.truncate(@input.rewind)
- @input << "lisp\nruby\n"
- @input.rewind
- @output.truncate(@output.rewind)
-
- answer = @terminal.ask( "What is your favorite programming language? ",
- languages ) do |q|
- q.case = :capitalize
- end
- assert_equal(languages.last, answer)
- assert_equal( "What is your favorite programming language? " +
- "You must choose one of [:Perl, :Python, :Ruby].\n" +
- "? ", @output.string )
- end
-
- def test_case_changes
- @input << "jeg2\n"
- @input.rewind
-
- answer = @terminal.ask("Enter your initials ") do |q|
- q.case = :up
- end
- assert_equal("JEG2", answer)
-
- @input.truncate(@input.rewind)
- @input << "cRaZY\n"
- @input.rewind
-
- answer = @terminal.ask("Enter a search string: ") do |q|
- q.case = :down
- end
- assert_equal("crazy", answer)
- end
-
- def test_character_echo
- @input << "password\r"
- @input.rewind
-
- answer = @terminal.ask("Please enter your password: ") do |q|
- q.echo = "*"
- end
- assert_equal("password", answer)
- assert_equal("Please enter your password: ********\n", @output.string)
-
- @input.truncate(@input.rewind)
- @input << "2"
- @input.rewind
- @output.truncate(@output.rewind)
-
- answer = @terminal.ask( "Select an option (1, 2 or 3): ",
- Integer ) do |q|
- q.echo = "*"
- q.character = true
- end
- assert_equal(2, answer)
- assert_equal("Select an option (1, 2 or 3): *\n", @output.string)
- end
-
- def test_backspace_does_not_enter_prompt
- @input << "\b\b"
- @input.rewind
- answer = @terminal.ask("Please enter your password: ") do |q|
- q.echo = "*"
- end
- assert_equal("", answer)
- assert_equal("Please enter your password: \n",@output.string)
- end
-
- def test_readline_on_non_echo_question_has_prompt
- @input << "you can't see me"
- @input.rewind
- answer = @terminal.ask("Please enter some hidden text: ") do |q|
- q.readline = true
- q.echo = "*"
- end
- assert_equal("you can't see me", answer)
- assert_equal("Please enter some hidden text: ****************\n",@output.string)
- end
-
- def test_character_reading
- # WARNING: This method does NOT cover Unix and Windows savvy testing!
- @input << "12345"
- @input.rewind
-
- answer = @terminal.ask("Enter a single digit: ", Integer) do |q|
- q.character = :getc
- end
- assert_equal(1, answer)
- end
-
- def test_color
- @terminal.say("This should be <%= BLUE %>blue<%= CLEAR %>!")
- assert_equal("This should be \e[34mblue\e[0m!\n", @output.string)
-
- @output.truncate(@output.rewind)
-
- @terminal.say( "This should be " +
- "<%= BOLD + ON_WHITE %>bold on white<%= CLEAR %>!" )
- assert_equal( "This should be \e[1m\e[47mbold on white\e[0m!\n",
- @output.string )
-
- @output.truncate(@output.rewind)
-
- @terminal.say("This should be <%= color('cyan', CYAN) %>!")
- assert_equal("This should be \e[36mcyan\e[0m!\n", @output.string)
-
- @output.truncate(@output.rewind)
-
- @terminal.say( "This should be " +
- "<%= color('blinking on red', :blink, :on_red) %>!" )
- assert_equal( "This should be \e[5m\e[41mblinking on red\e[0m!\n",
- @output.string )
-
- @output.truncate(@output.rewind)
-
- # turn off color
- old_setting = HighLine.use_color?
- assert_nothing_raised(Exception) { HighLine.use_color = false }
- @terminal.say("This should be <%= color('cyan', CYAN) %>!")
- assert_equal("This should be cyan!\n", @output.string)
- HighLine.use_color = old_setting
- end
-
- def test_confirm
- @input << "junk.txt\nno\nsave.txt\ny\n"
- @input.rewind
-
- answer = @terminal.ask("Enter a filename: ") do |q|
- q.confirm = "Are you sure you want to overwrite <%= @answer %>? "
- q.responses[:ask_on_error] = :question
- end
- assert_equal("save.txt", answer)
- assert_equal( "Enter a filename: " +
- "Are you sure you want to overwrite junk.txt? " +
- "Enter a filename: " +
- "Are you sure you want to overwrite save.txt? ",
- @output.string )
-
- @input.truncate(@input.rewind)
- @input << "junk.txt\nyes\nsave.txt\nn\n"
- @input.rewind
- @output.truncate(@output.rewind)
-
- answer = @terminal.ask("Enter a filename: ") do |q|
- q.confirm = "Are you sure you want to overwrite <%= @answer %>? "
- end
- assert_equal("junk.txt", answer)
- assert_equal( "Enter a filename: " +
- "Are you sure you want to overwrite junk.txt? ",
- @output.string )
- end
-
- def test_defaults
- @input << "\nNo Comment\n"
- @input.rewind
-
- answer = @terminal.ask("Are you sexually active? ") do |q|
- q.validate = /\Ay(?:es)?|no?|no comment\Z/i
- end
- assert_equal("No Comment", answer)
-
- @input.truncate(@input.rewind)
- @input << "\nYes\n"
- @input.rewind
- @output.truncate(@output.rewind)
-
- answer = @terminal.ask("Are you sexually active? ") do |q|
- q.default = "No Comment"
- q.validate = /\Ay(?:es)?|no?|no comment\Z/i
- end
- assert_equal("No Comment", answer)
- assert_equal( "Are you sexually active? |No Comment| ",
- @output.string )
- end
-
- def test_empty
- @input << "\n"
- @input.rewind
-
- answer = @terminal.ask("") do |q|
- q.default = "yes"
- q.validate = /\Ay(?:es)?|no?\Z/i
- end
- assert_equal("yes", answer)
- end
-
- def test_erb
- @terminal.say( "The integers from 1 to 10 are:\n" +
- "% (1...10).each do |n|\n" +
- "\t<%= n %>,\n" +
- "% end\n" +
- "\tand 10" )
- assert_equal( "The integers from 1 to 10 are:\n" +
- "\t1,\n\t2,\n\t3,\n\t4,\n\t5,\n" +
- "\t6,\n\t7,\n\t8,\n\t9,\n\tand 10\n",
- @output.string )
- end
-
- def test_files
- @input << "#{File.basename(__FILE__)[0, 5]}\n"
- @input.rewind
-
- file = @terminal.ask("Select a file: ", File) do |q|
- q.directory = File.expand_path(File.dirname(__FILE__))
- q.glob = "*.rb"
- end
- assert_instance_of(File, file)
- assert_equal("#!/usr/local/bin/ruby -w\n", file.gets)
- assert_equal("\n", file.gets)
- assert_equal("# tc_highline.rb\n", file.gets)
- file.close
-
- @input.rewind
-
- pathname = @terminal.ask("Select a file: ", Pathname) do |q|
- q.directory = File.expand_path(File.dirname(__FILE__))
- q.glob = "*.rb"
- end
- assert_instance_of(Pathname, pathname)
- assert_equal(File.size(__FILE__), pathname.size)
- end
-
- def test_gather
- @input << "James\nDana\nStorm\nGypsy\n\n"
- @input.rewind
-
- answers = @terminal.ask("Enter four names:") do |q|
- q.gather = 4
- end
- assert_equal(%w{James Dana Storm Gypsy}, answers)
- assert_equal("\n", @input.gets)
- assert_equal("Enter four names:\n", @output.string)
-
- @input.rewind
-
- answers = @terminal.ask("Enter four names:") do |q|
- q.gather = ""
- end
- assert_equal(%w{James Dana Storm Gypsy}, answers)
-
- @input.rewind
-
- answers = @terminal.ask("Enter four names:") do |q|
- q.gather = /^\s*$/
- end
- assert_equal(%w{James Dana Storm Gypsy}, answers)
-
- @input.truncate(@input.rewind)
- @input << "29\n49\n30\n"
- @input.rewind
- @output.truncate(@output.rewind)
-
- answers = @terminal.ask("<%= @key %>: ", Integer) do |q|
- q.gather = { "Age" => 0, "Wife's Age" => 0, "Father's Age" => 0}
- end
- assert_equal( { "Age" => 29, "Wife's Age" => 30, "Father's Age" => 49},
- answers )
- assert_equal("Age: Father's Age: Wife's Age: ", @output.string)
- end
-
- def test_lists
- digits = %w{Zero One Two Three Four Five Six Seven Eight Nine}
- erb_digits = digits.dup
- erb_digits[erb_digits.index("Five")] = "<%= color('Five', :blue) %%>"
-
- @terminal.say("<%= list(#{digits.inspect}) %>")
- assert_equal(digits.map { |d| "#{d}\n" }.join, @output.string)
-
- @output.truncate(@output.rewind)
-
- @terminal.say("<%= list(#{digits.inspect}, :inline) %>")
- assert_equal( digits[0..-2].join(", ") + " or #{digits.last}\n",
- @output.string )
-
- @output.truncate(@output.rewind)
-
- @terminal.say("<%= list(#{digits.inspect}, :inline, ' and ') %>")
- assert_equal( digits[0..-2].join(", ") + " and #{digits.last}\n",
- @output.string )
-
- @output.truncate(@output.rewind)
-
- @terminal.say("<%= list(#{digits.inspect}, :columns_down, 3) %>")
- assert_equal( "Zero Four Eight\n" +
- "One Five Nine \n" +
- "Two Six \n" +
- "Three Seven\n",
- @output.string )
-
- @output.truncate(@output.rewind)
-
- @terminal.say("<%= list(#{erb_digits.inspect}, :columns_down, 3) %>")
- assert_equal( "Zero Four Eight\n" +
- "One \e[34mFive\e[0m Nine \n" +
- "Two Six \n" +
- "Three Seven\n",
- @output.string )
-
- colums_of_twenty = ["12345678901234567890"] * 5
-
- @output.truncate(@output.rewind)
-
- @terminal.say("<%= list(#{colums_of_twenty.inspect}, :columns_down) %>")
- assert_equal( "12345678901234567890 12345678901234567890 " +
- "12345678901234567890\n" +
- "12345678901234567890 12345678901234567890\n",
- @output.string )
-
- @output.truncate(@output.rewind)
-
- @terminal.say("<%= list(#{digits.inspect}, :columns_across, 3) %>")
- assert_equal( "Zero One Two \n" +
- "Three Four Five \n" +
- "Six Seven Eight\n" +
- "Nine \n",
- @output.string )
-
- colums_of_twenty.pop
-
- @output.truncate(@output.rewind)
-
- @terminal.say("<%= list( #{colums_of_twenty.inspect}, :columns_across ) %>")
- assert_equal( "12345678901234567890 12345678901234567890 " +
- "12345678901234567890\n" +
- "12345678901234567890\n",
- @output.string )
- end
-
- def test_mode
- assert(%w[Win32API termios stty].include?(HighLine::CHARACTER_MODE))
- end
-
- class NameClass
- def self.parse( string )
- if string =~ /^\s*(\w+),\s*(\w+)\s+(\w+)\s*$/
- self.new($2, $3, $1)
- else
- raise ArgumentError, "Invalid name format."
- end
- end
-
- def initialize(first, middle, last)
- @first, @middle, @last = first, middle, last
- end
-
- attr_reader :first, :middle, :last
- end
-
- def test_my_class_conversion
- @input << "Gray, James Edward\n"
- @input.rewind
-
- answer = @terminal.ask("Your name? ", NameClass) do |q|
- q.validate = lambda do |name|
- names = name.split(/,\s*/)
- return false unless names.size == 2
- return false if names.first =~ /\s/
- names.last.split.size == 2
- end
- end
- assert_instance_of(NameClass, answer)
- assert_equal("Gray", answer.last)
- assert_equal("James", answer.first)
- assert_equal("Edward", answer.middle)
- end
-
- def test_no_echo
- @input << "password\r"
- @input.rewind
-
- answer = @terminal.ask("Please enter your password: ") do |q|
- q.echo = false
- end
- assert_equal("password", answer)
- assert_equal("Please enter your password: \n", @output.string)
-
- @input.rewind
- @output.truncate(@output.rewind)
-
- answer = @terminal.ask("Pick a letter or number: ") do |q|
- q.character = true
- q.echo = false
- end
- assert_equal("p", answer)
- assert_equal("a", @input.getc.chr)
- assert_equal("Pick a letter or number: \n", @output.string)
- end
-
- def test_paging
- @terminal.page_at = 22
-
- @input << "\n\n"
- @input.rewind
-
- @terminal.say((1..50).map { |n| "This is line #{n}.\n"}.join)
- assert_equal( (1..22).map { |n| "This is line #{n}.\n"}.join +
- "\n-- press enter/return to continue or q to stop -- \n\n" +
- (23..44).map { |n| "This is line #{n}.\n"}.join +
- "\n-- press enter/return to continue or q to stop -- \n\n" +
- (45..50).map { |n| "This is line #{n}.\n"}.join,
- @output.string )
- end
-
- def test_range_requirements
- @input << "112\n-541\n28\n"
- @input.rewind
-
- answer = @terminal.ask("Tell me your age.", Integer) do |q|
- q.in = 0..105
- end
- assert_equal(28, answer)
- assert_equal( "Tell me your age.\n" +
- "Your answer isn't within the expected range " +
- "(included in 0..105).\n" +
- "? " +
- "Your answer isn't within the expected range " +
- "(included in 0..105).\n" +
- "? ", @output.string )
-
- @input.truncate(@input.rewind)
- @input << "1\n-541\n28\n"
- @input.rewind
- @output.truncate(@output.rewind)
-
- answer = @terminal.ask("Tell me your age.", Integer) do |q|
- q.above = 3
- end
- assert_equal(28, answer)
- assert_equal( "Tell me your age.\n" +
- "Your answer isn't within the expected range " +
- "(above 3).\n" +
- "? " +
- "Your answer isn't within the expected range " +
- "(above 3).\n" +
- "? ", @output.string )
-
- @input.truncate(@input.rewind)
- @input << "1\n28\n-541\n"
- @input.rewind
- @output.truncate(@output.rewind)
-
- answer = @terminal.ask("Lowest numer you can think of?", Integer) do |q|
- q.below = 0
- end
- assert_equal(-541, answer)
- assert_equal( "Lowest numer you can think of?\n" +
- "Your answer isn't within the expected range " +
- "(below 0).\n" +
- "? " +
- "Your answer isn't within the expected range " +
- "(below 0).\n" +
- "? ", @output.string )
-
- @input.truncate(@input.rewind)
- @input << "1\n-541\n6\n"
- @input.rewind
- @output.truncate(@output.rewind)
-
- answer = @terminal.ask("Enter a low even number: ", Integer) do |q|
- q.above = 0
- q.below = 10
- q.in = [2, 4, 6, 8]
- end
- assert_equal(6, answer)
- assert_equal( "Enter a low even number: " +
- "Your answer isn't within the expected range " +
- "(above 0, below 10, and included in [2, 4, 6, 8]).\n" +
- "? " +
- "Your answer isn't within the expected range " +
- "(above 0, below 10, and included in [2, 4, 6, 8]).\n" +
- "? ", @output.string )
- end
-
- def test_reask
- number = 61676
- @input << "Junk!\n" << number << "\n"
- @input.rewind
-
- answer = @terminal.ask("Favorite number? ", Integer)
- assert_kind_of(Integer, number)
- assert_instance_of(Fixnum, number)
- assert_equal(number, answer)
- assert_equal( "Favorite number? " +
- "You must enter a valid Integer.\n" +
- "? ", @output.string )
-
- @input.rewind
- @output.truncate(@output.rewind)
-
- answer = @terminal.ask("Favorite number? ", Integer) do |q|
- q.responses[:ask_on_error] = :question
- q.responses[:invalid_type] = "Not a valid number!"
- end
- assert_kind_of(Integer, number)
- assert_instance_of(Fixnum, number)
- assert_equal(number, answer)
- assert_equal( "Favorite number? " +
- "Not a valid number!\n" +
- "Favorite number? ", @output.string )
-
- @input.truncate(@input.rewind)
- @input << "gen\ngene\n"
- @input.rewind
- @output.truncate(@output.rewind)
-
- answer = @terminal.ask("Select a mode: ", [:generate, :gentle])
- assert_instance_of(Symbol, answer)
- assert_equal(:generate, answer)
- assert_equal( "Select a mode: " +
- "Ambiguous choice. " +
- "Please choose one of [:generate, :gentle].\n" +
- "? ", @output.string )
- end
-
- def test_response_embedding
- @input << "112\n-541\n28\n"
- @input.rewind
-
- answer = @terminal.ask("Tell me your age.", Integer) do |q|
- q.in = 0..105
- q.responses[:not_in_range] = "Need a <%= @question.answer_type %>" +
- " <%= @question.expected_range %>."
- end
- assert_equal(28, answer)
- assert_equal( "Tell me your age.\n" +
- "Need a Integer included in 0..105.\n" +
- "? " +
- "Need a Integer included in 0..105.\n" +
- "? ", @output.string )
- end
-
- def test_say
- @terminal.say("This will have a newline.")
- assert_equal("This will have a newline.\n", @output.string)
-
- @output.truncate(@output.rewind)
-
- @terminal.say("This will also have one newline.\n")
- assert_equal("This will also have one newline.\n", @output.string)
-
- @output.truncate(@output.rewind)
-
- @terminal.say("This will not have a newline. ")
- assert_equal("This will not have a newline. ", @output.string)
- end
-
- def test_type_conversion
- number = 61676
- @input << number << "\n"
- @input.rewind
-
- answer = @terminal.ask("Favorite number? ", Integer)
- assert_kind_of(Integer, answer)
- assert_instance_of(Fixnum, answer)
- assert_equal(number, answer)
-
- @input.truncate(@input.rewind)
- number = 1_000_000_000_000_000_000_000_000_000_000
- @input << number << "\n"
- @input.rewind
-
- answer = @terminal.ask("Favorite number? ", Integer)
- assert_kind_of(Integer, answer)
- assert_instance_of(Bignum, answer)
- assert_equal(number, answer)
-
- @input.truncate(@input.rewind)
- number = 10.5002
- @input << number << "\n"
- @input.rewind
-
- answer = @terminal.ask( "Favorite number? ",
- lambda { |n| n.to_f.abs.round } )
- assert_kind_of(Integer, answer)
- assert_instance_of(Fixnum, answer)
- assert_equal(11, answer)
-
- @input.truncate(@input.rewind)
- animal = :dog
- @input << animal << "\n"
- @input.rewind
-
- answer = @terminal.ask("Favorite animal? ", Symbol)
- assert_instance_of(Symbol, answer)
- assert_equal(animal, answer)
-
- @input.truncate(@input.rewind)
- @input << "6/16/76\n"
- @input.rewind
-
- answer = @terminal.ask("Enter your birthday.", Date)
- assert_instance_of(Date, answer)
- assert_equal(16, answer.day)
- assert_equal(6, answer.month)
- assert_equal(76, answer.year)
-
- @input.truncate(@input.rewind)
- pattern = "^yes|no$"
- @input << pattern << "\n"
- @input.rewind
-
- answer = @terminal.ask("Give me a pattern to match with: ", Regexp)
- assert_instance_of(Regexp, answer)
- assert_equal(/#{pattern}/, answer)
-
- @input.truncate(@input.rewind)
- @input << "gen\n"
- @input.rewind
-
- answer = @terminal.ask("Select a mode: ", [:generate, :run])
- assert_instance_of(Symbol, answer)
- assert_equal(:generate, answer)
- end
-
- def test_validation
- @input << "system 'rm -rf /'\n105\n0b101_001\n"
- @input.rewind
-
- answer = @terminal.ask("Enter a binary number: ") do |q|
- q.validate = /\A(?:0b)?[01_]+\Z/
- end
- assert_equal("0b101_001", answer)
- assert_equal( "Enter a binary number: " +
- "Your answer isn't valid " +
- "(must match /\\A(?:0b)?[01_]+\\Z/).\n" +
- "? " +
- "Your answer isn't valid " +
- "(must match /\\A(?:0b)?[01_]+\\Z/).\n" +
- "? ", @output.string )
-
- @input.truncate(@input.rewind)
- @input << "Gray II, James Edward\n" +
- "Gray, Dana Ann Leslie\n" +
- "Gray, James Edward\n"
- @input.rewind
-
- answer = @terminal.ask("Your name? ") do |q|
- q.validate = lambda do |name|
- names = name.split(/,\s*/)
- return false unless names.size == 2
- return false if names.first =~ /\s/
- names.last.split.size == 2
- end
- end
- assert_equal("Gray, James Edward", answer)
- end
-
- def test_whitespace
- @input << " A lot\tof \t space\t \there! \n"
- @input.rewind
-
- answer = @terminal.ask("Enter a whitespace filled string: ") do |q|
- q.whitespace = :chomp
- end
- assert_equal(" A lot\tof \t space\t \there! ", answer)
-
- @input.rewind
-
- answer = @terminal.ask("Enter a whitespace filled string: ")
- assert_equal("A lot\tof \t space\t \there!", answer)
-
- @input.rewind
-
- answer = @terminal.ask("Enter a whitespace filled string: ") do |q|
- q.whitespace = :strip_and_collapse
- end
- assert_equal("A lot of space here!", answer)
-
- @input.rewind
-
- answer = @terminal.ask("Enter a whitespace filled string: ") do |q|
- q.whitespace = :remove
- end
- assert_equal("Alotofspacehere!", answer)
-
- @input.rewind
-
- answer = @terminal.ask("Enter a whitespace filled string: ") do |q|
- q.whitespace = :none
- end
- assert_equal(" A lot\tof \t space\t \there! \n", answer)
- end
-
- def test_wrap
- @terminal.wrap_at = 80
-
- @terminal.say("This is a very short line.")
- assert_equal("This is a very short line.\n", @output.string)
-
- @output.truncate(@output.rewind)
-
- @terminal.say( "This is a long flowing paragraph meant to span " +
- "several lines. This text should definitely be " +
- "wrapped at the set limit, in the result. Your code " +
- "does well with things like this.\n\n" +
- " * This is a simple embedded list.\n" +
- " * You're code should not mess with this...\n" +
- " * Because it's already formatted correctly and " +
- "does not\n" +
- " exceed the limit!" )
- assert_equal( "This is a long flowing paragraph meant to span " +
- "several lines. This text should\n" +
- "definitely be wrapped at the set limit, in the " +
- "result. Your code does well with\n" +
- "things like this.\n\n" +
- " * This is a simple embedded list.\n" +
- " * You're code should not mess with this...\n" +
- " * Because it's already formatted correctly and does " +
- "not\n" +
- " exceed the limit!\n", @output.string )
-
- @output.truncate(@output.rewind)
-
- @terminal.say("-=" * 50)
- assert_equal(("-=" * 40 + "\n") + ("-=" * 10 + "\n"), @output.string)
- end
-
- def test_track_eof
- assert_raise(EOFError) { @terminal.ask("Any input left? ") }
-
- # turn EOF tracking
- old_setting = HighLine.track_eof?
- assert_nothing_raised(Exception) { HighLine.track_eof = false }
- begin
- @terminal.ask("And now? ") # this will still blow up, nothing available
- rescue
- assert_not_equal(EOFError, $!.class) # but HighLine's safe guards are off
- end
- HighLine.track_eof = old_setting
- end
-
- def test_version
- assert_not_nil(HighLine::VERSION)
- assert_instance_of(String, HighLine::VERSION)
- assert(HighLine::VERSION.frozen?)
- assert_match(/\A\d\.\d\.\d\Z/, HighLine::VERSION)
- end
-end
diff --git a/vendor/gems/highline-1.5.0/test/tc_import.rb b/vendor/gems/highline-1.5.0/test/tc_import.rb
deleted file mode 100644
index 005d5a92..00000000
--- a/vendor/gems/highline-1.5.0/test/tc_import.rb
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/usr/local/bin/ruby -w
-
-# tc_import.rb
-#
-# Created by James Edward Gray II on 2005-04-26.
-# Copyright 2005 Gray Productions. All rights reserved.
-#
-# This is Free Software. See LICENSE and COPYING for details.
-
-require "test/unit"
-
-require "highline/import"
-require "stringio"
-
-class TestImport < Test::Unit::TestCase
- def test_import
- assert_respond_to(self, :agree)
- assert_respond_to(self, :ask)
- assert_respond_to(self, :choose)
- assert_respond_to(self, :say)
- end
-
- def test_or_ask
- old_terminal = $terminal
-
- input = StringIO.new
- output = StringIO.new
- $terminal = HighLine.new(input, output)
-
- input << "10\n"
- input.rewind
-
- assert_equal(10, nil.or_ask("How much? ", Integer))
-
- input.rewind
-
- assert_equal(20, "20".or_ask("How much? ", Integer))
- assert_equal(20, 20.or_ask("How much? ", Integer))
-
- assert_equal(10, 20.or_ask("How much? ", Integer) { |q| q.in = 1..10 })
- ensure
- $terminal = old_terminal
- end
-
- def test_redirection
- old_terminal = $terminal
-
- $terminal = HighLine.new(nil, (output = StringIO.new))
- say("Testing...")
- assert_equal("Testing...\n", output.string)
- ensure
- $terminal = old_terminal
- end
-end
diff --git a/vendor/gems/highline-1.5.0/test/tc_menu.rb b/vendor/gems/highline-1.5.0/test/tc_menu.rb
deleted file mode 100644
index fee18714..00000000
--- a/vendor/gems/highline-1.5.0/test/tc_menu.rb
+++ /dev/null
@@ -1,429 +0,0 @@
-#!/usr/local/bin/ruby -w
-
-# tc_menu.rb
-#
-# Created by Gregory Thomas Brown on 2005-05-10.
-# Copyright 2005. All rights reserved.
-#
-# This is Free Software. See LICENSE and COPYING for details.
-
-require "test/unit"
-
-require "highline"
-require "stringio"
-
-class TestMenu < Test::Unit::TestCase
- def setup
- @input = StringIO.new
- @output = StringIO.new
- @terminal = HighLine.new(@input, @output)
- end
-
- def test_choices
- @input << "2\n"
- @input.rewind
-
- output = @terminal.choose do |menu|
- menu.choices("Sample1", "Sample2", "Sample3")
- end
- assert_equal("Sample2", output)
- end
-
- def test_flow
- @input << "Sample1\n"
- @input.rewind
-
- @terminal.choose do |menu|
- # Default: menu.flow = :rows
-
- menu.choice "Sample1"
- menu.choice "Sample2"
- menu.choice "Sample3"
- end
- assert_equal("1. Sample1\n2. Sample2\n3. Sample3\n? ", @output.string)
-
- @output.truncate(@output.rewind)
- @input.rewind
-
- @terminal.choose do |menu|
- menu.flow = :columns_across
-
- menu.choice "Sample1"
- menu.choice "Sample2"
- menu.choice "Sample3"
- end
- assert_equal("1. Sample1 2. Sample2 3. Sample3\n? ", @output.string)
-
- @output.truncate(@output.rewind)
- @input.rewind
-
- @terminal.choose do |menu|
- menu.flow = :inline
- menu.index = :none
-
- menu.choice "Sample1"
- menu.choice "Sample2"
- menu.choice "Sample3"
- end
- assert_equal("Sample1, Sample2 or Sample3? ", @output.string)
- end
-
- def test_help
- @input << "help\nhelp load\nhelp rules\nhelp missing\n"
- @input.rewind
-
- 4.times do
- @terminal.choose do |menu|
- menu.shell = true
-
- menu.choice(:load, "Load a file.")
- menu.choice(:save, "Save data in file.")
- menu.choice(:quit, "Exit program.")
-
- menu.help("rules", "The rules of this system are as follows...")
- end
- end
- assert_equal( "1. load\n2. save\n3. quit\n4. help\n? " +
- "This command will display helpful messages about " +
- "functionality, like this one. To see the help for a " +
- "specific topic enter:\n" +
- "\thelp [TOPIC]\n" +
- "Try asking for help on any of the following:\n" +
- "\nload quit rules save \n" +
- "1. load\n2. save\n3. quit\n4. help\n? " +
- "= load\n\n" +
- "Load a file.\n" +
- "1. load\n2. save\n3. quit\n4. help\n? " +
- "= rules\n\n" +
- "The rules of this system are as follows...\n" +
- "1. load\n2. save\n3. quit\n4. help\n? " +
- "= missing\n\n" +
- "There's no help for that topic.\n", @output.string )
- end
-
- def test_index
- @input << "Sample1\n"
- @input.rewind
-
- @terminal.choose do |menu|
- # Default: menu.index = :number
-
- menu.choice "Sample1"
- menu.choice "Sample2"
- menu.choice "Sample3"
- end
- assert_equal("1. Sample1\n2. Sample2\n3. Sample3\n? ", @output.string)
-
- @output.truncate(@output.rewind)
- @input.rewind
-
- @terminal.choose do |menu|
- menu.index = :letter
- menu.index_suffix = ") "
-
- menu.choice "Sample1"
- menu.choice "Sample2"
- menu.choice "Sample3"
- end
- assert_equal("a) Sample1\nb) Sample2\nc) Sample3\n? ", @output.string)
-
- @output.truncate(@output.rewind)
- @input.rewind
-
- @terminal.choose do |menu|
- menu.index = :none
-
- menu.choice "Sample1"
- menu.choice "Sample2"
- menu.choice "Sample3"
- end
- assert_equal("Sample1\nSample2\nSample3\n? ", @output.string)
-
- @output.truncate(@output.rewind)
- @input.rewind
-
- @terminal.choose do |menu|
- menu.index = "*"
-
- menu.choice "Sample1"
- menu.choice "Sample2"
- menu.choice "Sample3"
- end
- assert_equal("* Sample1\n* Sample2\n* Sample3\n? ", @output.string)
- end
-
- def test_layouts
- @input << "save\n"
- @input.rewind
-
- @terminal.choose(:load, :save, :quit) # Default: layout = :list
- assert_equal("1. load\n2. save\n3. quit\n? ", @output.string)
-
- @input.rewind
- @output.truncate(@output.rewind)
-
- @terminal.choose(:load, :save, :quit) do |menu|
- menu.header = "File Menu"
- end
- assert_equal( "File Menu:\n" +
- "1. load\n2. save\n3. quit\n? ", @output.string )
-
- @input.rewind
- @output.truncate(@output.rewind)
-
- @terminal.choose(:load, :save, :quit) do |menu|
- menu.layout = :one_line
- menu.header = "File Menu"
- menu.prompt = "Operation? "
- end
- assert_equal( "File Menu: Operation? " +
- "(load, save or quit) ", @output.string )
-
- @input.rewind
- @output.truncate(@output.rewind)
-
- @terminal.choose(:load, :save, :quit) do |menu|
- menu.layout = :menu_only
- end
- assert_equal("load, save or quit? ", @output.string)
-
- @input.rewind
- @output.truncate(@output.rewind)
-
- @terminal.choose(:load, :save, :quit) do |menu|
- menu.layout = '<%= list(@menu) %>File Menu: '
- end
- assert_equal("1. load\n2. save\n3. quit\nFile Menu: ", @output.string)
- end
-
- def test_list_option
- @input << "l\n"
- @input.rewind
-
- @terminal.choose(:load, :save, :quit) do |menu|
- menu.layout = :menu_only
- menu.list_option = ", or "
- end
- assert_equal("load, save, or quit? ", @output.string)
- end
-
- def test_nil_on_handled
- @input << "3\n3\n2\n"
- @input.rewind
-
- # Shows that by default proc results are returned.
- output = @terminal.choose do |menu|
- menu.choice "Sample1" do "output1" end
- menu.choice "Sample2" do "output2" end
- menu.choice "Sample3" do "output3" end
- end
- assert_equal("output3", output)
-
- #
- # Shows that they can be replaced with +nil+ by setting
- # _nil_on_handled to +true+.
- #
- output = @terminal.choose do |menu|
- menu.nil_on_handled = true
- menu.choice "Sample1" do "output1" end
- menu.choice "Sample2" do "output2" end
- menu.choice "Sample3" do "output3" end
- end
- assert_equal(nil, output)
-
- # Shows that a menu item without a proc will be returned no matter what.
- output = @terminal.choose do |menu|
- menu.choice "Sample1"
- menu.choice "Sample2"
- menu.choice "Sample3"
- end
- assert_equal("Sample2", output)
- end
-
- def test_passed_command
- @input << "q\n"
- @input.rewind
-
- selected = nil
- @terminal.choose do |menu|
- menu.choices(:load, :save, :quit) { |command| selected = command }
- end
- assert_equal(:quit, selected)
- end
-
- def test_question_options
- @input << "save\n"
- @input.rewind
-
- answer = @terminal.choose(:Load, :Save, :Quit) do |menu|
- menu.case = :capitalize
- end
- assert_equal(:Save, answer)
-
- @input.rewind
-
- answer = @terminal.choose(:Load, :Save, :Quit) do |menu|
- menu.case = :capitalize
- menu.character = :getc
- end
- assert_equal(:Save, answer)
- assert_equal(?a, @input.getc)
- end
-
- def test_select_by
- @input << "Sample1\n2\n"
- @input.rewind
-
- selected = @terminal.choose do |menu|
- menu.choice "Sample1"
- menu.choice "Sample2"
- menu.choice "Sample3"
- end
- assert_equal("Sample1", selected)
-
- @input.rewind
-
- selected = @terminal.choose do |menu|
- menu.select_by = :index
-
- menu.choice "Sample1"
- menu.choice "Sample2"
- menu.choice "Sample3"
- end
- assert_equal("Sample2", selected)
-
- @input.rewind
-
- selected = @terminal.choose do |menu|
- menu.select_by = :name
-
- menu.choice "Sample1"
- menu.choice "Sample2"
- menu.choice "Sample3"
- end
- assert_equal("Sample1", selected)
- end
-
- def test_hidden
- @input << "Hidden\n4\n"
- @input.rewind
-
- selected = @terminal.choose do |menu|
- menu.choice "Sample1"
- menu.choice "Sample2"
- menu.choice "Sample3"
- menu.hidden "Hidden!"
- end
- assert_equal("Hidden!", selected)
- assert_equal("1. Sample1\n2. Sample2\n3. Sample3\n? ", @output.string)
-
- @input.rewind
-
- selected = @terminal.choose do |menu|
- menu.select_by = :index
-
- menu.choice "Sample1"
- menu.choice "Sample2"
- menu.choice "Sample3"
- menu.hidden "Hidden!"
- end
- assert_equal("Hidden!", selected)
-
- @input.rewind
-
- selected = @terminal.choose do |menu|
- menu.select_by = :name
-
- menu.choice "Sample1"
- menu.choice "Sample2"
- menu.choice "Sample3"
- menu.hidden "Hidden!"
- end
- assert_equal("Hidden!", selected)
-
- @input.rewind
- end
-
- def test_select_by_letter
- @input << "b\n"
- @input.rewind
-
- selected = @terminal.choose do |menu|
- menu.index = :letter
- menu.choice :save
- menu.choice :load
- menu.choice :quit
- end
- assert_equal(:load, selected)
- end
-
- def test_shell
- @input << "save --some-option my_file.txt\n"
- @input.rewind
-
- selected = nil
- options = nil
- answer = @terminal.choose do |menu|
- menu.choices(:load, :quit)
- menu.choice(:save) do |command, details|
- selected = command
- options = details
-
- "Saved!"
- end
- menu.shell = true
- end
- assert_equal("Saved!", answer)
- assert_equal(:save, selected)
- assert_equal("--some-option my_file.txt", options)
- end
-
- def test_simple_menu_shortcut
- @input << "3\n"
- @input.rewind
-
- selected = @terminal.choose(:save, :load, :quit)
- assert_equal(:quit, selected)
- end
-
- def test_symbols
- @input << "3\n"
- @input.rewind
-
- selected = @terminal.choose do |menu|
- menu.choices(:save, :load, :quit)
- end
- assert_equal(:quit, selected)
- end
-
- def test_paged_print_infinite_loop_bug
- @terminal.page_at = 5
- # Will page twice, so start with two new lines
- @input << "\n\n3\n"
- @input.rewind
-
- # Sadly this goes into an infinite loop without the fix to page_print
- selected = @terminal.choose(* 1..10)
- assert_equal(selected, 3)
- end
-
-
- def test_cancel_paging
- # Tests that paging can be cancelled halfway through
- @terminal.page_at = 5
- # Will page twice, so stop after first page and make choice 3
- @input << "q\n3\n"
- @input.rewind
-
- selected = @terminal.choose(* 1..10)
- assert_equal(selected, 3)
-
- # Make sure paging message appeared
- assert( @output.string.index('press enter/return to continue or q to stop'),
- "Paging message did not appear." )
-
- # Make sure it only appeared once
- assert( @output.string !~ /q to stop.*q to stop/m,
- "Paging message appeared more than once." )
- end
-end
diff --git a/vendor/gems/highline-1.5.0/test/ts_all.rb b/vendor/gems/highline-1.5.0/test/ts_all.rb
deleted file mode 100644
index 735dccee..00000000
--- a/vendor/gems/highline-1.5.0/test/ts_all.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/usr/local/bin/ruby -w
-
-# ts_all.rb
-#
-# Created by James Edward Gray II on 2005-04-26.
-# Copyright 2005 Gray Productions. All rights reserved.
-#
-# This is Free Software. See LICENSE and COPYING for details.
-
-require "test/unit"
-
-require "tc_highline"
-require "tc_import"
-require "tc_menu"
-require "tc_color_scheme"
diff --git a/vendor/gems/rack-1.1.0/.specification b/vendor/gems/rack-1.1.0/.specification
deleted file mode 100644
index ef892653..00000000
--- a/vendor/gems/rack-1.1.0/.specification
+++ /dev/null
@@ -1,314 +0,0 @@
---- !ruby/object:Gem::Specification
-name: rack
-version: !ruby/object:Gem::Version
- hash: 19
- prerelease: false
- segments:
- - 1
- - 1
- - 0
- version: 1.1.0
-platform: ruby
-authors:
-- Christian Neukirchen
-autorequire:
-bindir: bin
-cert_chain: []
-
-date: 2010-01-04 00:00:00 +01:00
-default_executable: rackup
-dependencies:
-- !ruby/object:Gem::Dependency
- name: test-spec
- prerelease: false
- requirement: &id001 !ruby/object:Gem::Requirement
- none: false
- requirements:
- - - ">="
- - !ruby/object:Gem::Version
- hash: 3
- segments:
- - 0
- version: "0"
- type: :development
- version_requirements: *id001
-- !ruby/object:Gem::Dependency
- name: camping
- prerelease: false
- requirement: &id002 !ruby/object:Gem::Requirement
- none: false
- requirements:
- - - ">="
- - !ruby/object:Gem::Version
- hash: 3
- segments:
- - 0
- version: "0"
- type: :development
- version_requirements: *id002
-- !ruby/object:Gem::Dependency
- name: fcgi
- prerelease: false
- requirement: &id003 !ruby/object:Gem::Requirement
- none: false
- requirements:
- - - ">="
- - !ruby/object:Gem::Version
- hash: 3
- segments:
- - 0
- version: "0"
- type: :development
- version_requirements: *id003
-- !ruby/object:Gem::Dependency
- name: memcache-client
- prerelease: false
- requirement: &id004 !ruby/object:Gem::Requirement
- none: false
- requirements:
- - - ">="
- - !ruby/object:Gem::Version
- hash: 3
- segments:
- - 0
- version: "0"
- type: :development
- version_requirements: *id004
-- !ruby/object:Gem::Dependency
- name: mongrel
- prerelease: false
- requirement: &id005 !ruby/object:Gem::Requirement
- none: false
- requirements:
- - - ">="
- - !ruby/object:Gem::Version
- hash: 3
- segments:
- - 0
- version: "0"
- type: :development
- version_requirements: *id005
-- !ruby/object:Gem::Dependency
- name: thin
- prerelease: false
- requirement: &id006 !ruby/object:Gem::Requirement
- none: false
- requirements:
- - - ">="
- - !ruby/object:Gem::Version
- hash: 3
- segments:
- - 0
- version: "0"
- type: :development
- version_requirements: *id006
-description: |
- Rack provides minimal, modular and adaptable interface for developing
- web applications in Ruby. By wrapping HTTP requests and responses in
- the simplest way possible, it unifies and distills the API for web
- servers, web frameworks, and software in between (the so-called
- middleware) into a single method call.
-
- Also see http://rack.rubyforge.org.
-
-email: chneukirchen@gmail.com
-executables:
-- rackup
-extensions: []
-
-extra_rdoc_files:
-- README
-- SPEC
-- KNOWN-ISSUES
-files:
-- bin/rackup
-- contrib/rack_logo.svg
-- example/lobster.ru
-- example/protectedlobster.rb
-- example/protectedlobster.ru
-- lib/rack/adapter/camping.rb
-- lib/rack/auth/abstract/handler.rb
-- lib/rack/auth/abstract/request.rb
-- lib/rack/auth/basic.rb
-- lib/rack/auth/digest/md5.rb
-- lib/rack/auth/digest/nonce.rb
-- lib/rack/auth/digest/params.rb
-- lib/rack/auth/digest/request.rb
-- lib/rack/builder.rb
-- lib/rack/cascade.rb
-- lib/rack/chunked.rb
-- lib/rack/commonlogger.rb
-- lib/rack/conditionalget.rb
-- lib/rack/config.rb
-- lib/rack/content_length.rb
-- lib/rack/content_type.rb
-- lib/rack/deflater.rb
-- lib/rack/directory.rb
-- lib/rack/etag.rb
-- lib/rack/file.rb
-- lib/rack/handler/cgi.rb
-- lib/rack/handler/evented_mongrel.rb
-- lib/rack/handler/fastcgi.rb
-- lib/rack/handler/lsws.rb
-- lib/rack/handler/mongrel.rb
-- lib/rack/handler/scgi.rb
-- lib/rack/handler/swiftiplied_mongrel.rb
-- lib/rack/handler/thin.rb
-- lib/rack/handler/webrick.rb
-- lib/rack/handler.rb
-- lib/rack/head.rb
-- lib/rack/lint.rb
-- lib/rack/lobster.rb
-- lib/rack/lock.rb
-- lib/rack/logger.rb
-- lib/rack/methodoverride.rb
-- lib/rack/mime.rb
-- lib/rack/mock.rb
-- lib/rack/nulllogger.rb
-- lib/rack/recursive.rb
-- lib/rack/reloader.rb
-- lib/rack/request.rb
-- lib/rack/response.rb
-- lib/rack/rewindable_input.rb
-- lib/rack/runtime.rb
-- lib/rack/sendfile.rb
-- lib/rack/server.rb
-- lib/rack/session/abstract/id.rb
-- lib/rack/session/cookie.rb
-- lib/rack/session/memcache.rb
-- lib/rack/session/pool.rb
-- lib/rack/showexceptions.rb
-- lib/rack/showstatus.rb
-- lib/rack/static.rb
-- lib/rack/urlmap.rb
-- lib/rack/utils.rb
-- lib/rack.rb
-- COPYING
-- KNOWN-ISSUES
-- rack.gemspec
-- RDOX
-- README
-- SPEC
-- test/spec_rack_auth_basic.rb
-- test/spec_rack_auth_digest.rb
-- test/spec_rack_builder.rb
-- test/spec_rack_camping.rb
-- test/spec_rack_cascade.rb
-- test/spec_rack_cgi.rb
-- test/spec_rack_chunked.rb
-- test/spec_rack_commonlogger.rb
-- test/spec_rack_conditionalget.rb
-- test/spec_rack_config.rb
-- test/spec_rack_content_length.rb
-- test/spec_rack_content_type.rb
-- test/spec_rack_deflater.rb
-- test/spec_rack_directory.rb
-- test/spec_rack_etag.rb
-- test/spec_rack_fastcgi.rb
-- test/spec_rack_file.rb
-- test/spec_rack_handler.rb
-- test/spec_rack_head.rb
-- test/spec_rack_lint.rb
-- test/spec_rack_lobster.rb
-- test/spec_rack_lock.rb
-- test/spec_rack_logger.rb
-- test/spec_rack_methodoverride.rb
-- test/spec_rack_mock.rb
-- test/spec_rack_mongrel.rb
-- test/spec_rack_nulllogger.rb
-- test/spec_rack_recursive.rb
-- test/spec_rack_request.rb
-- test/spec_rack_response.rb
-- test/spec_rack_rewindable_input.rb
-- test/spec_rack_runtime.rb
-- test/spec_rack_sendfile.rb
-- test/spec_rack_session_cookie.rb
-- test/spec_rack_session_memcache.rb
-- test/spec_rack_session_pool.rb
-- test/spec_rack_showexceptions.rb
-- test/spec_rack_showstatus.rb
-- test/spec_rack_static.rb
-- test/spec_rack_thin.rb
-- test/spec_rack_urlmap.rb
-- test/spec_rack_utils.rb
-- test/spec_rack_webrick.rb
-- test/spec_rackup.rb
-has_rdoc: true
-homepage: http://rack.rubyforge.org
-licenses: []
-
-post_install_message:
-rdoc_options: []
-
-require_paths:
-- lib
-required_ruby_version: !ruby/object:Gem::Requirement
- none: false
- requirements:
- - - ">="
- - !ruby/object:Gem::Version
- hash: 3
- segments:
- - 0
- version: "0"
-required_rubygems_version: !ruby/object:Gem::Requirement
- none: false
- requirements:
- - - ">="
- - !ruby/object:Gem::Version
- hash: 3
- segments:
- - 0
- version: "0"
-requirements: []
-
-rubyforge_project: rack
-rubygems_version: 1.3.7
-signing_key:
-specification_version: 3
-summary: a modular Ruby webserver interface
-test_files:
-- test/spec_rack_auth_basic.rb
-- test/spec_rack_auth_digest.rb
-- test/spec_rack_builder.rb
-- test/spec_rack_camping.rb
-- test/spec_rack_cascade.rb
-- test/spec_rack_cgi.rb
-- test/spec_rack_chunked.rb
-- test/spec_rack_commonlogger.rb
-- test/spec_rack_conditionalget.rb
-- test/spec_rack_config.rb
-- test/spec_rack_content_length.rb
-- test/spec_rack_content_type.rb
-- test/spec_rack_deflater.rb
-- test/spec_rack_directory.rb
-- test/spec_rack_etag.rb
-- test/spec_rack_fastcgi.rb
-- test/spec_rack_file.rb
-- test/spec_rack_handler.rb
-- test/spec_rack_head.rb
-- test/spec_rack_lint.rb
-- test/spec_rack_lobster.rb
-- test/spec_rack_lock.rb
-- test/spec_rack_logger.rb
-- test/spec_rack_methodoverride.rb
-- test/spec_rack_mock.rb
-- test/spec_rack_mongrel.rb
-- test/spec_rack_nulllogger.rb
-- test/spec_rack_recursive.rb
-- test/spec_rack_request.rb
-- test/spec_rack_response.rb
-- test/spec_rack_rewindable_input.rb
-- test/spec_rack_runtime.rb
-- test/spec_rack_sendfile.rb
-- test/spec_rack_session_cookie.rb
-- test/spec_rack_session_memcache.rb
-- test/spec_rack_session_pool.rb
-- test/spec_rack_showexceptions.rb
-- test/spec_rack_showstatus.rb
-- test/spec_rack_static.rb
-- test/spec_rack_thin.rb
-- test/spec_rack_urlmap.rb
-- test/spec_rack_utils.rb
-- test/spec_rack_webrick.rb
-- test/spec_rackup.rb
diff --git a/vendor/gems/rack-1.1.0/COPYING b/vendor/gems/rack-1.1.0/COPYING
deleted file mode 100644
index 83b390bc..00000000
--- a/vendor/gems/rack-1.1.0/COPYING
+++ /dev/null
@@ -1,18 +0,0 @@
-Copyright (c) 2007, 2008, 2009, 2010 Christian Neukirchen
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to
-deal in the Software without restriction, including without limitation the
-rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-sell copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
-IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/vendor/gems/rack-1.1.0/KNOWN-ISSUES b/vendor/gems/rack-1.1.0/KNOWN-ISSUES
deleted file mode 100644
index a1af5dc1..00000000
--- a/vendor/gems/rack-1.1.0/KNOWN-ISSUES
+++ /dev/null
@@ -1,21 +0,0 @@
-= Known issues with Rack and Web servers
-
-* Lighttpd sets wrong SCRIPT_NAME and PATH_INFO if you mount your
- FastCGI app at "/". This can be fixed by using this middleware:
-
- class LighttpdScriptNameFix
- def initialize(app)
- @app = app
- end
-
- def call(env)
- env["PATH_INFO"] = env["SCRIPT_NAME"].to_s + env["PATH_INFO"].to_s
- env["SCRIPT_NAME"] = ""
- @app.call(env)
- end
- end
-
- Of course, use this only when your app runs at "/".
-
- Since lighttpd 1.4.23, you also can use the "fix-root-scriptname" flag
- in fastcgi.server.
diff --git a/vendor/gems/rack-1.1.0/RDOX b/vendor/gems/rack-1.1.0/RDOX
deleted file mode 100644
index e69de29b..00000000
diff --git a/vendor/gems/rack-1.1.0/README b/vendor/gems/rack-1.1.0/README
deleted file mode 100644
index 777b12d3..00000000
--- a/vendor/gems/rack-1.1.0/README
+++ /dev/null
@@ -1,399 +0,0 @@
-= Rack, a modular Ruby webserver interface
-
-Rack provides a minimal, modular and adaptable interface for developing
-web applications in Ruby. By wrapping HTTP requests and responses in
-the simplest way possible, it unifies and distills the API for web
-servers, web frameworks, and software in between (the so-called
-middleware) into a single method call.
-
-The exact details of this are described in the Rack specification,
-which all Rack applications should conform to.
-
-== Specification changes in this release
-
-With Rack 1.1, the Rack specification (found in SPEC) changed in the
-following backward-incompatible ways.
-
-* Rack::VERSION has been pushed to [1,1].
-* rack.logger is now specified.
-* The SPEC now allows subclasses of the required types.
-* rack.input has to be opened in binary mode.
-
-== Supported web servers
-
-The included *handlers* connect all kinds of web servers to Rack:
-* Mongrel
-* EventedMongrel
-* SwiftipliedMongrel
-* WEBrick
-* FCGI
-* CGI
-* SCGI
-* LiteSpeed
-* Thin
-
-These web servers include Rack handlers in their distributions:
-* Ebb
-* Fuzed
-* Glassfish v3
-* Phusion Passenger (which is mod_rack for Apache and for nginx)
-* Rainbows!
-* Unicorn
-* Zbatery
-
-Any valid Rack app will run the same on all these handlers, without
-changing anything.
-
-== Supported web frameworks
-
-The included *adapters* connect Rack with existing Ruby web frameworks:
-* Camping
-
-These frameworks include Rack adapters in their distributions:
-* Camping
-* Coset
-* Halcyon
-* Mack
-* Maveric
-* Merb
-* Racktools::SimpleApplication
-* Ramaze
-* Ruby on Rails
-* Rum
-* Sinatra
-* Sin
-* Vintage
-* Waves
-* Wee
-* ... and many others.
-
-Current links to these projects can be found at
-http://wiki.ramaze.net/Home#other-frameworks
-
-== Available middleware
-
-Between the server and the framework, Rack can be customized to your
-applications needs using middleware, for example:
-* Rack::URLMap, to route to multiple applications inside the same process.
-* Rack::CommonLogger, for creating Apache-style logfiles.
-* Rack::ShowException, for catching unhandled exceptions and
- presenting them in a nice and helpful way with clickable backtrace.
-* Rack::File, for serving static files.
-* ...many others!
-
-All these components use the same interface, which is described in
-detail in the Rack specification. These optional components can be
-used in any way you wish.
-
-== Convenience
-
-If you want to develop outside of existing frameworks, implement your
-own ones, or develop middleware, Rack provides many helpers to create
-Rack applications quickly and without doing the same web stuff all
-over:
-* Rack::Request, which also provides query string parsing and
- multipart handling.
-* Rack::Response, for convenient generation of HTTP replies and
- cookie handling.
-* Rack::MockRequest and Rack::MockResponse for efficient and quick
- testing of Rack application without real HTTP round-trips.
-
-== rack-contrib
-
-The plethora of useful middleware created the need for a project that
-collects fresh Rack middleware. rack-contrib includes a variety of
-add-on components for Rack and it is easy to contribute new modules.
-
-* http://github.com/rack/rack-contrib
-
-== rackup
-
-rackup is a useful tool for running Rack applications, which uses the
-Rack::Builder DSL to configure middleware and build up applications
-easily.
-
-rackup automatically figures out the environment it is run in, and
-runs your application as FastCGI, CGI, or standalone with Mongrel or
-WEBrick---all from the same configuration.
-
-== Quick start
-
-Try the lobster!
-
-Either with the embedded WEBrick starter:
-
- ruby -Ilib lib/rack/lobster.rb
-
-Or with rackup:
-
- bin/rackup -Ilib example/lobster.ru
-
-By default, the lobster is found at http://localhost:9292.
-
-== Installing with RubyGems
-
-A Gem of Rack is available at gemcutter.org. You can install it with:
-
- gem install rack
-
-I also provide a local mirror of the gems (and development snapshots)
-at my site:
-
- gem install rack --source http://chneukirchen.org/releases/gems/
-
-== Running the tests
-
-Testing Rack requires the test/spec testing framework:
-
- gem install test-spec
-
-There are two rake-based test tasks:
-
- rake test tests all the fast tests (no Handlers or Adapters)
- rake fulltest runs all the tests
-
-The fast testsuite has no dependencies outside of the core Ruby
-installation and test-spec.
-
-To run the test suite completely, you need:
-
- * camping
- * fcgi
- * memcache-client
- * mongrel
- * thin
-
-The full set of tests test FCGI access with lighttpd (on port
-9203) so you will need lighttpd installed as well as the FCGI
-libraries and the fcgi gem:
-
-Download and install lighttpd:
-
- http://www.lighttpd.net/download
-
-Installing the FCGI libraries:
-
- curl -O http://www.fastcgi.com/dist/fcgi-2.4.0.tar.gz
- tar xzvf fcgi-2.4.0.tar.gz
- cd fcgi-2.4.0
- ./configure --prefix=/usr/local
- make
- sudo make install
- cd ..
-
-Installing the Ruby fcgi gem:
-
- gem install fcgi
-
-Furthermore, to test Memcache sessions, you need memcached (will be
-run on port 11211) and memcache-client installed.
-
-== History
-
-* March 3rd, 2007: First public release 0.1.
-
-* May 16th, 2007: Second public release 0.2.
- * HTTP Basic authentication.
- * Cookie Sessions.
- * Static file handler.
- * Improved Rack::Request.
- * Improved Rack::Response.
- * Added Rack::ShowStatus, for better default error messages.
- * Bug fixes in the Camping adapter.
- * Removed Rails adapter, was too alpha.
-
-* February 26th, 2008: Third public release 0.3.
- * LiteSpeed handler, by Adrian Madrid.
- * SCGI handler, by Jeremy Evans.
- * Pool sessions, by blink.
- * OpenID authentication, by blink.
- * :Port and :File options for opening FastCGI sockets, by blink.
- * Last-Modified HTTP header for Rack::File, by blink.
- * Rack::Builder#use now accepts blocks, by Corey Jewett.
- (See example/protectedlobster.ru)
- * HTTP status 201 can contain a Content-Type and a body now.
- * Many bugfixes, especially related to Cookie handling.
-
-* August 21st, 2008: Fourth public release 0.4.
- * New middleware, Rack::Deflater, by Christoffer Sawicki.
- * OpenID authentication now needs ruby-openid 2.
- * New Memcache sessions, by blink.
- * Explicit EventedMongrel handler, by Joshua Peek
- * Rack::Reloader is not loaded in rackup development mode.
- * rackup can daemonize with -D.
- * Many bugfixes, especially for pool sessions, URLMap, thread safety
- and tempfile handling.
- * Improved tests.
- * Rack moved to Git.
-
-* January 6th, 2009: Fifth public release 0.9.
- * Rack is now managed by the Rack Core Team.
- * Rack::Lint is stricter and follows the HTTP RFCs more closely.
- * Added ConditionalGet middleware.
- * Added ContentLength middleware.
- * Added Deflater middleware.
- * Added Head middleware.
- * Added MethodOverride middleware.
- * Rack::Mime now provides popular MIME-types and their extension.
- * Mongrel Header now streams.
- * Added Thin handler.
- * Official support for swiftiplied Mongrel.
- * Secure cookies.
- * Made HeaderHash case-preserving.
- * Many bugfixes and small improvements.
-
-* January 9th, 2009: Sixth public release 0.9.1.
- * Fix directory traversal exploits in Rack::File and Rack::Directory.
-
-* April 25th, 2009: Seventh public release 1.0.0.
- * SPEC change: Rack::VERSION has been pushed to [1,0].
- * SPEC change: header values must be Strings now, split on "\n".
- * SPEC change: Content-Length can be missing, in this case chunked transfer
- encoding is used.
- * SPEC change: rack.input must be rewindable and support reading into
- a buffer, wrap with Rack::RewindableInput if it isn't.
- * SPEC change: rack.session is now specified.
- * SPEC change: Bodies can now additionally respond to #to_path with
- a filename to be served.
- * NOTE: String bodies break in 1.9, use an Array consisting of a
- single String instead.
- * New middleware Rack::Lock.
- * New middleware Rack::ContentType.
- * Rack::Reloader has been rewritten.
- * Major update to Rack::Auth::OpenID.
- * Support for nested parameter parsing in Rack::Response.
- * Support for redirects in Rack::Response.
- * HttpOnly cookie support in Rack::Response.
- * The Rakefile has been rewritten.
- * Many bugfixes and small improvements.
-
-* October 18th, 2009: Eighth public release 1.0.1.
- * Bump remainder of rack.versions.
- * Support the pure Ruby FCGI implementation.
- * Fix for form names containing "=": split first then unescape components
- * Fixes the handling of the filename parameter with semicolons in names.
- * Add anchor to nested params parsing regexp to prevent stack overflows
- * Use more compatible gzip write api instead of "<<".
- * Make sure that Reloader doesn't break when executed via ruby -e
- * Make sure WEBrick respects the :Host option
- * Many Ruby 1.9 fixes.
-
-* January 3rd, 2009: Ninth public release 1.1.0.
- * Moved Auth::OpenID to rack-contrib.
- * SPEC change that relaxes Lint slightly to allow subclasses of the
- required types
- * SPEC change to document rack.input binary mode in greator detail
- * SPEC define optional rack.logger specification
- * File servers support X-Cascade header
- * Imported Config middleware
- * Imported ETag middleware
- * Imported Runtime middleware
- * Imported Sendfile middleware
- * New Logger and NullLogger middlewares
- * Added mime type for .ogv and .manifest.
- * Don't squeeze PATH_INFO slashes
- * Use Content-Type to determine POST params parsing
- * Update Rack::Utils::HTTP_STATUS_CODES hash
- * Add status code lookup utility
- * Response should call #to_i on the status
- * Add Request#user_agent
- * Request#host knows about forwared host
- * Return an empty string for Request#host if HTTP_HOST and
- SERVER_NAME are both missing
- * Allow MockRequest to accept hash params
- * Optimizations to HeaderHash
- * Refactored rackup into Rack::Server
- * Added Utils.build_nested_query to complement Utils.parse_nested_query
- * Added Utils::Multipart.build_multipart to complement
- Utils::Multipart.parse_multipart
- * Extracted set and delete cookie helpers into Utils so they can be
- used outside Response
- * Extract parse_query and parse_multipart in Request so subclasses
- can change their behavior
- * Enforce binary encoding in RewindableInput
- * Set correct external_encoding for handlers that don't use RewindableInput
-
-== Contact
-
-Please post bugs, suggestions and patches to
-the bug tracker at .
-
-Mailing list archives are available at
-.
-
-Git repository (send Git patches to the mailing list):
-* http://github.com/rack/rack
-* http://git.vuxu.org/cgi-bin/gitweb.cgi?p=rack.git
-
-You are also welcome to join the #rack channel on irc.freenode.net.
-
-== Thanks
-
-The Rack Core Team, consisting of
-
-* Christian Neukirchen (chneukirchen)
-* James Tucker (raggi)
-* Josh Peek (josh)
-* Michael Fellinger (manveru)
-* Ryan Tomayko (rtomayko)
-* Scytrin dai Kinthra (scytrin)
-
-would like to thank:
-
-* Adrian Madrid, for the LiteSpeed handler.
-* Christoffer Sawicki, for the first Rails adapter and Rack::Deflater.
-* Tim Fletcher, for the HTTP authentication code.
-* Luc Heinrich for the Cookie sessions, the static file handler and bugfixes.
-* Armin Ronacher, for the logo and racktools.
-* Aredridel, Ben Alpert, Dan Kubb, Daniel Roethlisberger, Matt Todd,
- Tom Robinson, Phil Hagelberg, S. Brent Faulkner, Bosko Milekic,
- Daniel Rodríguez Troitiño, Genki Takiuchi, Geoffrey Grosenbach,
- Julien Sanchez, Kamal Fariz Mahyuddin, Masayoshi Takahashi, Patrick
- Aljordm, Mig, and Kazuhiro Nishiyama for bug fixing and other
- improvements.
-* Eric Wong, Hongli Lai, Jeremy Kemper for their continuous support
- and API improvements.
-* Yehuda Katz and Carl Lerche for refactoring rackup.
-* Brian Candler, for Rack::ContentType.
-* Graham Batty, for improved handler loading.
-* Stephen Bannasch, for bug reports and documentation.
-* Gary Wright, for proposing a better Rack::Response interface.
-* Jonathan Buch, for improvements regarding Rack::Response.
-* Armin Röhrl, for tracking down bugs in the Cookie generator.
-* Alexander Kellett for testing the Gem and reviewing the announcement.
-* Marcus Rückert, for help with configuring and debugging lighttpd.
-* The WSGI team for the well-done and documented work they've done and
- Rack builds up on.
-* All bug reporters and patch contributers not mentioned above.
-
-== Copyright
-
-Copyright (C) 2007, 2008, 2009, 2010 Christian Neukirchen
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to
-deal in the Software without restriction, including without limitation the
-rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-sell copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
-IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-== Links
-
-Rack::
-Rack's Rubyforge project::
-Official Rack repositories::
-Rack Lighthouse Bug Tracking::
-rack-devel mailing list::
-
-Christian Neukirchen::
-
diff --git a/vendor/gems/rack-1.1.0/SPEC b/vendor/gems/rack-1.1.0/SPEC
deleted file mode 100644
index d2260cbe..00000000
--- a/vendor/gems/rack-1.1.0/SPEC
+++ /dev/null
@@ -1,171 +0,0 @@
-This specification aims to formalize the Rack protocol. You
-can (and should) use Rack::Lint to enforce it.
-When you develop middleware, be sure to add a Lint before and
-after to catch all mistakes.
-= Rack applications
-A Rack application is an Ruby object (not a class) that
-responds to +call+.
-It takes exactly one argument, the *environment*
-and returns an Array of exactly three values:
-The *status*,
-the *headers*,
-and the *body*.
-== The Environment
-The environment must be an true instance of Hash (no
-subclassing allowed) that includes CGI-like headers.
-The application is free to modify the environment.
-The environment is required to include these variables
-(adopted from PEP333), except when they'd be empty, but see
-below.
-REQUEST_METHOD:: The HTTP request method, such as
- "GET" or "POST". This cannot ever
- be an empty string, and so is
- always required.
-SCRIPT_NAME:: The initial portion of the request
- URL's "path" that corresponds to the
- application object, so that the
- application knows its virtual
- "location". This may be an empty
- string, if the application corresponds
- to the "root" of the server.
-PATH_INFO:: The remainder of the request URL's
- "path", designating the virtual
- "location" of the request's target
- within the application. This may be an
- empty string, if the request URL targets
- the application root and does not have a
- trailing slash. This value may be
- percent-encoded when I originating from
- a URL.
-QUERY_STRING:: The portion of the request URL that
- follows the ?, if any. May be
- empty, but is always required!
-SERVER_NAME, SERVER_PORT:: When combined with SCRIPT_NAME and PATH_INFO, these variables can be used to complete the URL. Note, however, that HTTP_HOST, if present, should be used in preference to SERVER_NAME for reconstructing the request URL. SERVER_NAME and SERVER_PORT can never be empty strings, and so are always required.
-HTTP_ Variables:: Variables corresponding to the
- client-supplied HTTP request
- headers (i.e., variables whose
- names begin with HTTP_). The
- presence or absence of these
- variables should correspond with
- the presence or absence of the
- appropriate HTTP header in the
- request.
-In addition to this, the Rack environment must include these
-Rack-specific variables:
-rack.version:: The Array [1,1], representing this version of Rack.
-rack.url_scheme:: +http+ or +https+, depending on the request URL.
-rack.input:: See below, the input stream.
-rack.errors:: See below, the error stream.
-rack.multithread:: true if the application object may be simultaneously invoked by another thread in the same process, false otherwise.
-rack.multiprocess:: true if an equivalent application object may be simultaneously invoked by another process, false otherwise.
-rack.run_once:: true if the server expects (but does not guarantee!) that the application will only be invoked this one time during the life of its containing process. Normally, this will only be true for a server based on CGI (or something similar).
-Additional environment specifications have approved to
-standardized middleware APIs. None of these are required to
-be implemented by the server.
-rack.session:: A hash like interface for storing request session data.
- The store must implement:
- store(key, value) (aliased as []=);
- fetch(key, default = nil) (aliased as []);
- delete(key);
- clear;
-rack.logger:: A common object interface for logging messages.
- The object must implement:
- info(message, &block)
- debug(message, &block)
- warn(message, &block)
- error(message, &block)
- fatal(message, &block)
-The server or the application can store their own data in the
-environment, too. The keys must contain at least one dot,
-and should be prefixed uniquely. The prefix rack.
-is reserved for use with the Rack core distribution and other
-accepted specifications and must not be used otherwise.
-The environment must not contain the keys
-HTTP_CONTENT_TYPE or HTTP_CONTENT_LENGTH
-(use the versions without HTTP_).
-The CGI keys (named without a period) must have String values.
-There are the following restrictions:
-* rack.version must be an array of Integers.
-* rack.url_scheme must either be +http+ or +https+.
-* There must be a valid input stream in rack.input.
-* There must be a valid error stream in rack.errors.
-* The REQUEST_METHOD must be a valid token.
-* The SCRIPT_NAME, if non-empty, must start with /
-* The PATH_INFO, if non-empty, must start with /
-* The CONTENT_LENGTH, if given, must consist of digits only.
-* One of SCRIPT_NAME or PATH_INFO must be
- set. PATH_INFO should be / if
- SCRIPT_NAME is empty.
- SCRIPT_NAME never should be /, but instead be empty.
-=== The Input Stream
-The input stream is an IO-like object which contains the raw HTTP
-POST data.
-When applicable, its external encoding must be "ASCII-8BIT" and it
-must be opened in binary mode, for Ruby 1.9 compatibility.
-The input stream must respond to +gets+, +each+, +read+ and +rewind+.
-* +gets+ must be called without arguments and return a string,
- or +nil+ on EOF.
-* +read+ behaves like IO#read. Its signature is read([length, [buffer]]).
- If given, +length+ must be an non-negative Integer (>= 0) or +nil+, and +buffer+ must
- be a String and may not be nil. If +length+ is given and not nil, then this method
- reads at most +length+ bytes from the input stream. If +length+ is not given or nil,
- then this method reads all data until EOF.
- When EOF is reached, this method returns nil if +length+ is given and not nil, or ""
- if +length+ is not given or is nil.
- If +buffer+ is given, then the read data will be placed into +buffer+ instead of a
- newly created String object.
-* +each+ must be called without arguments and only yield Strings.
-* +rewind+ must be called without arguments. It rewinds the input
- stream back to the beginning. It must not raise Errno::ESPIPE:
- that is, it may not be a pipe or a socket. Therefore, handler
- developers must buffer the input data into some rewindable object
- if the underlying input stream is not rewindable.
-* +close+ must never be called on the input stream.
-=== The Error Stream
-The error stream must respond to +puts+, +write+ and +flush+.
-* +puts+ must be called with a single argument that responds to +to_s+.
-* +write+ must be called with a single argument that is a String.
-* +flush+ must be called without arguments and must be called
- in order to make the error appear for sure.
-* +close+ must never be called on the error stream.
-== The Response
-=== The Status
-This is an HTTP status. When parsed as integer (+to_i+), it must be
-greater than or equal to 100.
-=== The Headers
-The header must respond to +each+, and yield values of key and value.
-The header keys must be Strings.
-The header must not contain a +Status+ key,
-contain keys with : or newlines in their name,
-contain keys names that end in - or _,
-but only contain keys that consist of
-letters, digits, _ or - and start with a letter.
-The values of the header must be Strings,
-consisting of lines (for multiple header values, e.g. multiple
-Set-Cookie values) seperated by "\n".
-The lines must not contain characters below 037.
-=== The Content-Type
-There must be a Content-Type, except when the
-+Status+ is 1xx, 204 or 304, in which case there must be none
-given.
-=== The Content-Length
-There must not be a Content-Length header when the
-+Status+ is 1xx, 204 or 304.
-=== The Body
-The Body must respond to +each+
-and must only yield String values.
-The Body itself should not be an instance of String, as this will
-break in Ruby 1.9.
-If the Body responds to +close+, it will be called after iteration.
-If the Body responds to +to_path+, it must return a String
-identifying the location of a file whose contents are identical
-to that produced by calling +each+; this may be used by the
-server as an alternative, possibly more efficient way to
-transport the response.
-The Body commonly is an Array of Strings, the application
-instance itself, or a File-like object.
-== Thanks
-Some parts of this specification are adopted from PEP333: Python
-Web Server Gateway Interface
-v1.0 (http://www.python.org/dev/peps/pep-0333/). I'd like to thank
-everyone involved in that effort.
diff --git a/vendor/gems/rack-1.1.0/bin/rackup b/vendor/gems/rack-1.1.0/bin/rackup
deleted file mode 100755
index ad94af4b..00000000
--- a/vendor/gems/rack-1.1.0/bin/rackup
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/usr/bin/env ruby
-
-require "rack"
-Rack::Server.start
diff --git a/vendor/gems/rack-1.1.0/contrib/rack_logo.svg b/vendor/gems/rack-1.1.0/contrib/rack_logo.svg
deleted file mode 100644
index 905dcd32..00000000
--- a/vendor/gems/rack-1.1.0/contrib/rack_logo.svg
+++ /dev/null
@@ -1,111 +0,0 @@
-
-
-
diff --git a/vendor/gems/rack-1.1.0/example/lobster.ru b/vendor/gems/rack-1.1.0/example/lobster.ru
deleted file mode 100644
index cc7ffcae..00000000
--- a/vendor/gems/rack-1.1.0/example/lobster.ru
+++ /dev/null
@@ -1,4 +0,0 @@
-require 'rack/lobster'
-
-use Rack::ShowExceptions
-run Rack::Lobster.new
diff --git a/vendor/gems/rack-1.1.0/example/protectedlobster.rb b/vendor/gems/rack-1.1.0/example/protectedlobster.rb
deleted file mode 100644
index 108b9d05..00000000
--- a/vendor/gems/rack-1.1.0/example/protectedlobster.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-require 'rack'
-require 'rack/lobster'
-
-lobster = Rack::Lobster.new
-
-protected_lobster = Rack::Auth::Basic.new(lobster) do |username, password|
- 'secret' == password
-end
-
-protected_lobster.realm = 'Lobster 2.0'
-
-pretty_protected_lobster = Rack::ShowStatus.new(Rack::ShowExceptions.new(protected_lobster))
-
-Rack::Handler::WEBrick.run pretty_protected_lobster, :Port => 9292
diff --git a/vendor/gems/rack-1.1.0/example/protectedlobster.ru b/vendor/gems/rack-1.1.0/example/protectedlobster.ru
deleted file mode 100644
index b0da62f0..00000000
--- a/vendor/gems/rack-1.1.0/example/protectedlobster.ru
+++ /dev/null
@@ -1,8 +0,0 @@
-require 'rack/lobster'
-
-use Rack::ShowExceptions
-use Rack::Auth::Basic, "Lobster 2.0" do |username, password|
- 'secret' == password
-end
-
-run Rack::Lobster.new
diff --git a/vendor/gems/rack-1.1.0/lib/rack.rb b/vendor/gems/rack-1.1.0/lib/rack.rb
deleted file mode 100644
index c118fc07..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack.rb
+++ /dev/null
@@ -1,92 +0,0 @@
-# Copyright (C) 2007, 2008, 2009, 2010 Christian Neukirchen
-#
-# Rack is freely distributable under the terms of an MIT-style license.
-# See COPYING or http://www.opensource.org/licenses/mit-license.php.
-
-# The Rack main module, serving as a namespace for all core Rack
-# modules and classes.
-#
-# All modules meant for use in your application are autoloaded here,
-# so it should be enough just to require rack.rb in your code.
-
-module Rack
- # The Rack protocol version number implemented.
- VERSION = [1,1]
-
- # Return the Rack protocol version as a dotted string.
- def self.version
- VERSION.join(".")
- end
-
- # Return the Rack release as a dotted string.
- def self.release
- "1.1"
- end
-
- autoload :Builder, "rack/builder"
- autoload :Cascade, "rack/cascade"
- autoload :Chunked, "rack/chunked"
- autoload :CommonLogger, "rack/commonlogger"
- autoload :ConditionalGet, "rack/conditionalget"
- autoload :Config, "rack/config"
- autoload :ContentLength, "rack/content_length"
- autoload :ContentType, "rack/content_type"
- autoload :ETag, "rack/etag"
- autoload :File, "rack/file"
- autoload :Deflater, "rack/deflater"
- autoload :Directory, "rack/directory"
- autoload :ForwardRequest, "rack/recursive"
- autoload :Handler, "rack/handler"
- autoload :Head, "rack/head"
- autoload :Lint, "rack/lint"
- autoload :Lock, "rack/lock"
- autoload :Logger, "rack/logger"
- autoload :MethodOverride, "rack/methodoverride"
- autoload :Mime, "rack/mime"
- autoload :NullLogger, "rack/nulllogger"
- autoload :Recursive, "rack/recursive"
- autoload :Reloader, "rack/reloader"
- autoload :Runtime, "rack/runtime"
- autoload :Sendfile, "rack/sendfile"
- autoload :Server, "rack/server"
- autoload :ShowExceptions, "rack/showexceptions"
- autoload :ShowStatus, "rack/showstatus"
- autoload :Static, "rack/static"
- autoload :URLMap, "rack/urlmap"
- autoload :Utils, "rack/utils"
-
- autoload :MockRequest, "rack/mock"
- autoload :MockResponse, "rack/mock"
-
- autoload :Request, "rack/request"
- autoload :Response, "rack/response"
-
- module Auth
- autoload :Basic, "rack/auth/basic"
- autoload :AbstractRequest, "rack/auth/abstract/request"
- autoload :AbstractHandler, "rack/auth/abstract/handler"
- module Digest
- autoload :MD5, "rack/auth/digest/md5"
- autoload :Nonce, "rack/auth/digest/nonce"
- autoload :Params, "rack/auth/digest/params"
- autoload :Request, "rack/auth/digest/request"
- end
- end
-
- module Session
- autoload :Cookie, "rack/session/cookie"
- autoload :Pool, "rack/session/pool"
- autoload :Memcache, "rack/session/memcache"
- end
-
- # *Adapters* connect Rack with third party web frameworks.
- #
- # Rack includes an adapter for Camping, see README for other
- # frameworks supporting Rack in their code bases.
- #
- # Refer to the submodules for framework-specific calling details.
-
- module Adapter
- autoload :Camping, "rack/adapter/camping"
- end
-end
diff --git a/vendor/gems/rack-1.1.0/lib/rack/adapter/camping.rb b/vendor/gems/rack-1.1.0/lib/rack/adapter/camping.rb
deleted file mode 100644
index 63bc787f..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack/adapter/camping.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-module Rack
- module Adapter
- class Camping
- def initialize(app)
- @app = app
- end
-
- def call(env)
- env["PATH_INFO"] ||= ""
- env["SCRIPT_NAME"] ||= ""
- controller = @app.run(env['rack.input'], env)
- h = controller.headers
- h.each_pair do |k,v|
- if v.kind_of? URI
- h[k] = v.to_s
- end
- end
- [controller.status, controller.headers, [controller.body.to_s]]
- end
- end
- end
-end
diff --git a/vendor/gems/rack-1.1.0/lib/rack/auth/abstract/handler.rb b/vendor/gems/rack-1.1.0/lib/rack/auth/abstract/handler.rb
deleted file mode 100644
index 214df629..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack/auth/abstract/handler.rb
+++ /dev/null
@@ -1,37 +0,0 @@
-module Rack
- module Auth
- # Rack::Auth::AbstractHandler implements common authentication functionality.
- #
- # +realm+ should be set for all handlers.
-
- class AbstractHandler
-
- attr_accessor :realm
-
- def initialize(app, realm=nil, &authenticator)
- @app, @realm, @authenticator = app, realm, authenticator
- end
-
-
- private
-
- def unauthorized(www_authenticate = challenge)
- return [ 401,
- { 'Content-Type' => 'text/plain',
- 'Content-Length' => '0',
- 'WWW-Authenticate' => www_authenticate.to_s },
- []
- ]
- end
-
- def bad_request
- return [ 400,
- { 'Content-Type' => 'text/plain',
- 'Content-Length' => '0' },
- []
- ]
- end
-
- end
- end
-end
diff --git a/vendor/gems/rack-1.1.0/lib/rack/auth/abstract/request.rb b/vendor/gems/rack-1.1.0/lib/rack/auth/abstract/request.rb
deleted file mode 100644
index 1d9ccec6..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack/auth/abstract/request.rb
+++ /dev/null
@@ -1,37 +0,0 @@
-module Rack
- module Auth
- class AbstractRequest
-
- def initialize(env)
- @env = env
- end
-
- def provided?
- !authorization_key.nil?
- end
-
- def parts
- @parts ||= @env[authorization_key].split(' ', 2)
- end
-
- def scheme
- @scheme ||= parts.first.downcase.to_sym
- end
-
- def params
- @params ||= parts.last
- end
-
-
- private
-
- AUTHORIZATION_KEYS = ['HTTP_AUTHORIZATION', 'X-HTTP_AUTHORIZATION', 'X_HTTP_AUTHORIZATION']
-
- def authorization_key
- @authorization_key ||= AUTHORIZATION_KEYS.detect { |key| @env.has_key?(key) }
- end
-
- end
-
- end
-end
diff --git a/vendor/gems/rack-1.1.0/lib/rack/auth/basic.rb b/vendor/gems/rack-1.1.0/lib/rack/auth/basic.rb
deleted file mode 100644
index 95572246..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack/auth/basic.rb
+++ /dev/null
@@ -1,58 +0,0 @@
-require 'rack/auth/abstract/handler'
-require 'rack/auth/abstract/request'
-
-module Rack
- module Auth
- # Rack::Auth::Basic implements HTTP Basic Authentication, as per RFC 2617.
- #
- # Initialize with the Rack application that you want protecting,
- # and a block that checks if a username and password pair are valid.
- #
- # See also: example/protectedlobster.rb
-
- class Basic < AbstractHandler
-
- def call(env)
- auth = Basic::Request.new(env)
-
- return unauthorized unless auth.provided?
-
- return bad_request unless auth.basic?
-
- if valid?(auth)
- env['REMOTE_USER'] = auth.username
-
- return @app.call(env)
- end
-
- unauthorized
- end
-
-
- private
-
- def challenge
- 'Basic realm="%s"' % realm
- end
-
- def valid?(auth)
- @authenticator.call(*auth.credentials)
- end
-
- class Request < Auth::AbstractRequest
- def basic?
- :basic == scheme
- end
-
- def credentials
- @credentials ||= params.unpack("m*").first.split(/:/, 2)
- end
-
- def username
- credentials.first
- end
- end
-
- end
- end
-end
diff --git a/vendor/gems/rack-1.1.0/lib/rack/auth/digest/md5.rb b/vendor/gems/rack-1.1.0/lib/rack/auth/digest/md5.rb
deleted file mode 100644
index e579dc96..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack/auth/digest/md5.rb
+++ /dev/null
@@ -1,124 +0,0 @@
-require 'rack/auth/abstract/handler'
-require 'rack/auth/digest/request'
-require 'rack/auth/digest/params'
-require 'rack/auth/digest/nonce'
-require 'digest/md5'
-
-module Rack
- module Auth
- module Digest
- # Rack::Auth::Digest::MD5 implements the MD5 algorithm version of
- # HTTP Digest Authentication, as per RFC 2617.
- #
- # Initialize with the [Rack] application that you want protecting,
- # and a block that looks up a plaintext password for a given username.
- #
- # +opaque+ needs to be set to a constant base64/hexadecimal string.
- #
- class MD5 < AbstractHandler
-
- attr_accessor :opaque
-
- attr_writer :passwords_hashed
-
- def initialize(*args)
- super
- @passwords_hashed = nil
- end
-
- def passwords_hashed?
- !!@passwords_hashed
- end
-
- def call(env)
- auth = Request.new(env)
-
- unless auth.provided?
- return unauthorized
- end
-
- if !auth.digest? || !auth.correct_uri? || !valid_qop?(auth)
- return bad_request
- end
-
- if valid?(auth)
- if auth.nonce.stale?
- return unauthorized(challenge(:stale => true))
- else
- env['REMOTE_USER'] = auth.username
-
- return @app.call(env)
- end
- end
-
- unauthorized
- end
-
-
- private
-
- QOP = 'auth'.freeze
-
- def params(hash = {})
- Params.new do |params|
- params['realm'] = realm
- params['nonce'] = Nonce.new.to_s
- params['opaque'] = H(opaque)
- params['qop'] = QOP
-
- hash.each { |k, v| params[k] = v }
- end
- end
-
- def challenge(hash = {})
- "Digest #{params(hash)}"
- end
-
- def valid?(auth)
- valid_opaque?(auth) && valid_nonce?(auth) && valid_digest?(auth)
- end
-
- def valid_qop?(auth)
- QOP == auth.qop
- end
-
- def valid_opaque?(auth)
- H(opaque) == auth.opaque
- end
-
- def valid_nonce?(auth)
- auth.nonce.valid?
- end
-
- def valid_digest?(auth)
- digest(auth, @authenticator.call(auth.username)) == auth.response
- end
-
- def md5(data)
- ::Digest::MD5.hexdigest(data)
- end
-
- alias :H :md5
-
- def KD(secret, data)
- H([secret, data] * ':')
- end
-
- def A1(auth, password)
- [ auth.username, auth.realm, password ] * ':'
- end
-
- def A2(auth)
- [ auth.method, auth.uri ] * ':'
- end
-
- def digest(auth, password)
- password_hash = passwords_hashed? ? password : H(A1(auth, password))
-
- KD(password_hash, [ auth.nonce, auth.nc, auth.cnonce, QOP, H(A2(auth)) ] * ':')
- end
-
- end
- end
- end
-end
diff --git a/vendor/gems/rack-1.1.0/lib/rack/auth/digest/nonce.rb b/vendor/gems/rack-1.1.0/lib/rack/auth/digest/nonce.rb
deleted file mode 100644
index dbe109f2..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack/auth/digest/nonce.rb
+++ /dev/null
@@ -1,51 +0,0 @@
-require 'digest/md5'
-
-module Rack
- module Auth
- module Digest
- # Rack::Auth::Digest::Nonce is the default nonce generator for the
- # Rack::Auth::Digest::MD5 authentication handler.
- #
- # +private_key+ needs to set to a constant string.
- #
- # +time_limit+ can be optionally set to an integer (number of seconds),
- # to limit the validity of the generated nonces.
-
- class Nonce
-
- class << self
- attr_accessor :private_key, :time_limit
- end
-
- def self.parse(string)
- new(*string.unpack("m*").first.split(' ', 2))
- end
-
- def initialize(timestamp = Time.now, given_digest = nil)
- @timestamp, @given_digest = timestamp.to_i, given_digest
- end
-
- def to_s
- [([ @timestamp, digest ] * ' ')].pack("m*").strip
- end
-
- def digest
- ::Digest::MD5.hexdigest([ @timestamp, self.class.private_key ] * ':')
- end
-
- def valid?
- digest == @given_digest
- end
-
- def stale?
- !self.class.time_limit.nil? && (@timestamp - Time.now.to_i) < self.class.time_limit
- end
-
- def fresh?
- !stale?
- end
-
- end
- end
- end
-end
diff --git a/vendor/gems/rack-1.1.0/lib/rack/auth/digest/params.rb b/vendor/gems/rack-1.1.0/lib/rack/auth/digest/params.rb
deleted file mode 100644
index 730e2efd..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack/auth/digest/params.rb
+++ /dev/null
@@ -1,55 +0,0 @@
-module Rack
- module Auth
- module Digest
- class Params < Hash
-
- def self.parse(str)
- split_header_value(str).inject(new) do |header, param|
- k, v = param.split('=', 2)
- header[k] = dequote(v)
- header
- end
- end
-
- def self.dequote(str) # From WEBrick::HTTPUtils
- ret = (/\A"(.*)"\Z/ =~ str) ? $1 : str.dup
- ret.gsub!(/\\(.)/, "\\1")
- ret
- end
-
- def self.split_header_value(str)
- str.scan( /(\w+\=(?:"[^\"]+"|[^,]+))/n ).collect{ |v| v[0] }
- end
-
- def initialize
- super
-
- yield self if block_given?
- end
-
- def [](k)
- super k.to_s
- end
-
- def []=(k, v)
- super k.to_s, v.to_s
- end
-
- UNQUOTED = ['qop', 'nc', 'stale']
-
- def to_s
- inject([]) do |parts, (k, v)|
- parts << "#{k}=" + (UNQUOTED.include?(k) ? v.to_s : quote(v))
- parts
- end.join(', ')
- end
-
- def quote(str) # From WEBrick::HTTPUtils
- '"' << str.gsub(/[\\\"]/o, "\\\1") << '"'
- end
-
- end
- end
- end
-end
-
diff --git a/vendor/gems/rack-1.1.0/lib/rack/auth/digest/request.rb b/vendor/gems/rack-1.1.0/lib/rack/auth/digest/request.rb
deleted file mode 100644
index a8aa3bf9..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack/auth/digest/request.rb
+++ /dev/null
@@ -1,40 +0,0 @@
-require 'rack/auth/abstract/request'
-require 'rack/auth/digest/params'
-require 'rack/auth/digest/nonce'
-
-module Rack
- module Auth
- module Digest
- class Request < Auth::AbstractRequest
-
- def method
- @env['rack.methodoverride.original_method'] || @env['REQUEST_METHOD']
- end
-
- def digest?
- :digest == scheme
- end
-
- def correct_uri?
- (@env['SCRIPT_NAME'].to_s + @env['PATH_INFO'].to_s) == uri
- end
-
- def nonce
- @nonce ||= Nonce.parse(params['nonce'])
- end
-
- def params
- @params ||= Params.parse(parts.last)
- end
-
- def method_missing(sym)
- if params.has_key? key = sym.to_s
- return params[key]
- end
- super
- end
-
- end
- end
- end
-end
diff --git a/vendor/gems/rack-1.1.0/lib/rack/builder.rb b/vendor/gems/rack-1.1.0/lib/rack/builder.rb
deleted file mode 100644
index 530f0aaf..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack/builder.rb
+++ /dev/null
@@ -1,80 +0,0 @@
-module Rack
- # Rack::Builder implements a small DSL to iteratively construct Rack
- # applications.
- #
- # Example:
- #
- # app = Rack::Builder.new {
- # use Rack::CommonLogger
- # use Rack::ShowExceptions
- # map "/lobster" do
- # use Rack::Lint
- # run Rack::Lobster.new
- # end
- # }
- #
- # Or
- #
- # app = Rack::Builder.app do
- # use Rack::CommonLogger
- # lambda { |env| [200, {'Content-Type' => 'text/plain'}, 'OK'] }
- # end
- #
- # +use+ adds a middleware to the stack, +run+ dispatches to an application.
- # You can use +map+ to construct a Rack::URLMap in a convenient way.
-
- class Builder
- def self.parse_file(config, opts = Server::Options.new)
- options = {}
- if config =~ /\.ru$/
- cfgfile = ::File.read(config)
- if cfgfile[/^#\\(.*)/] && opts
- options = opts.parse! $1.split(/\s+/)
- end
- cfgfile.sub!(/^__END__\n.*/, '')
- app = eval "Rack::Builder.new {( " + cfgfile + "\n )}.to_app",
- TOPLEVEL_BINDING, config
- else
- require config
- app = Object.const_get(::File.basename(config, '.rb').capitalize)
- end
- return app, options
- end
-
- def initialize(&block)
- @ins = []
- instance_eval(&block) if block_given?
- end
-
- def self.app(&block)
- self.new(&block).to_app
- end
-
- def use(middleware, *args, &block)
- @ins << lambda { |app| middleware.new(app, *args, &block) }
- end
-
- def run(app)
- @ins << app #lambda { |nothing| app }
- end
-
- def map(path, &block)
- if @ins.last.kind_of? Hash
- @ins.last[path] = self.class.new(&block).to_app
- else
- @ins << {}
- map(path, &block)
- end
- end
-
- def to_app
- @ins[-1] = Rack::URLMap.new(@ins.last) if Hash === @ins.last
- inner_app = @ins.last
- @ins[0...-1].reverse.inject(inner_app) { |a, e| e.call(a) }
- end
-
- def call(env)
- to_app.call(env)
- end
- end
-end
diff --git a/vendor/gems/rack-1.1.0/lib/rack/cascade.rb b/vendor/gems/rack-1.1.0/lib/rack/cascade.rb
deleted file mode 100644
index 14c3e54d..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack/cascade.rb
+++ /dev/null
@@ -1,41 +0,0 @@
-module Rack
- # Rack::Cascade tries an request on several apps, and returns the
- # first response that is not 404 (or in a list of configurable
- # status codes).
-
- class Cascade
- NotFound = [404, {}, []]
-
- attr_reader :apps
-
- def initialize(apps, catch=404)
- @apps = []; @has_app = {}
- apps.each { |app| add app }
-
- @catch = {}
- [*catch].each { |status| @catch[status] = true }
- end
-
- def call(env)
- result = NotFound
-
- @apps.each do |app|
- result = app.call(env)
- break unless @catch.include?(result[0].to_i)
- end
-
- result
- end
-
- def add app
- @has_app[app] = true
- @apps << app
- end
-
- def include? app
- @has_app.include? app
- end
-
- alias_method :<<, :add
- end
-end
diff --git a/vendor/gems/rack-1.1.0/lib/rack/chunked.rb b/vendor/gems/rack-1.1.0/lib/rack/chunked.rb
deleted file mode 100644
index dddf9694..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack/chunked.rb
+++ /dev/null
@@ -1,49 +0,0 @@
-require 'rack/utils'
-
-module Rack
-
- # Middleware that applies chunked transfer encoding to response bodies
- # when the response does not include a Content-Length header.
- class Chunked
- include Rack::Utils
-
- def initialize(app)
- @app = app
- end
-
- def call(env)
- status, headers, body = @app.call(env)
- headers = HeaderHash.new(headers)
-
- if env['HTTP_VERSION'] == 'HTTP/1.0' ||
- STATUS_WITH_NO_ENTITY_BODY.include?(status) ||
- headers['Content-Length'] ||
- headers['Transfer-Encoding']
- [status, headers, body]
- else
- dup.chunk(status, headers, body)
- end
- end
-
- def chunk(status, headers, body)
- @body = body
- headers.delete('Content-Length')
- headers['Transfer-Encoding'] = 'chunked'
- [status, headers, self]
- end
-
- def each
- term = "\r\n"
- @body.each do |chunk|
- size = bytesize(chunk)
- next if size == 0
- yield [size.to_s(16), term, chunk, term].join
- end
- yield ["0", term, "", term].join
- end
-
- def close
- @body.close if @body.respond_to?(:close)
- end
- end
-end
diff --git a/vendor/gems/rack-1.1.0/lib/rack/commonlogger.rb b/vendor/gems/rack-1.1.0/lib/rack/commonlogger.rb
deleted file mode 100644
index 1edc9b83..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack/commonlogger.rb
+++ /dev/null
@@ -1,49 +0,0 @@
-module Rack
- # Rack::CommonLogger forwards every request to an +app+ given, and
- # logs a line in the Apache common log format to the +logger+, or
- # rack.errors by default.
- class CommonLogger
- # Common Log Format: http://httpd.apache.org/docs/1.3/logs.html#common
- # lilith.local - - [07/Aug/2006 23:58:02] "GET / HTTP/1.1" 500 -
- # %{%s - %s [%s] "%s %s%s %s" %d %s\n} %
- FORMAT = %{%s - %s [%s] "%s %s%s %s" %d %s %0.4f\n}
-
- def initialize(app, logger=nil)
- @app = app
- @logger = logger
- end
-
- def call(env)
- began_at = Time.now
- status, header, body = @app.call(env)
- header = Utils::HeaderHash.new(header)
- log(env, status, header, began_at)
- [status, header, body]
- end
-
- private
-
- def log(env, status, header, began_at)
- now = Time.now
- length = extract_content_length(header)
-
- logger = @logger || env['rack.errors']
- logger.write FORMAT % [
- env['HTTP_X_FORWARDED_FOR'] || env["REMOTE_ADDR"] || "-",
- env["REMOTE_USER"] || "-",
- now.strftime("%d/%b/%Y %H:%M:%S"),
- env["REQUEST_METHOD"],
- env["PATH_INFO"],
- env["QUERY_STRING"].empty? ? "" : "?"+env["QUERY_STRING"],
- env["HTTP_VERSION"],
- status.to_s[0..3],
- length,
- now - began_at ]
- end
-
- def extract_content_length(headers)
- value = headers['Content-Length'] or return '-'
- value.to_s == '0' ? '-' : value
- end
- end
-end
diff --git a/vendor/gems/rack-1.1.0/lib/rack/conditionalget.rb b/vendor/gems/rack-1.1.0/lib/rack/conditionalget.rb
deleted file mode 100644
index 046ebdb0..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack/conditionalget.rb
+++ /dev/null
@@ -1,47 +0,0 @@
-require 'rack/utils'
-
-module Rack
-
- # Middleware that enables conditional GET using If-None-Match and
- # If-Modified-Since. The application should set either or both of the
- # Last-Modified or Etag response headers according to RFC 2616. When
- # either of the conditions is met, the response body is set to be zero
- # length and the response status is set to 304 Not Modified.
- #
- # Applications that defer response body generation until the body's each
- # message is received will avoid response body generation completely when
- # a conditional GET matches.
- #
- # Adapted from Michael Klishin's Merb implementation:
- # http://github.com/wycats/merb-core/tree/master/lib/merb-core/rack/middleware/conditional_get.rb
- class ConditionalGet
- def initialize(app)
- @app = app
- end
-
- def call(env)
- return @app.call(env) unless %w[GET HEAD].include?(env['REQUEST_METHOD'])
-
- status, headers, body = @app.call(env)
- headers = Utils::HeaderHash.new(headers)
- if etag_matches?(env, headers) || modified_since?(env, headers)
- status = 304
- headers.delete('Content-Type')
- headers.delete('Content-Length')
- body = []
- end
- [status, headers, body]
- end
-
- private
- def etag_matches?(env, headers)
- etag = headers['Etag'] and etag == env['HTTP_IF_NONE_MATCH']
- end
-
- def modified_since?(env, headers)
- last_modified = headers['Last-Modified'] and
- last_modified == env['HTTP_IF_MODIFIED_SINCE']
- end
- end
-
-end
diff --git a/vendor/gems/rack-1.1.0/lib/rack/config.rb b/vendor/gems/rack-1.1.0/lib/rack/config.rb
deleted file mode 100644
index c6d446c0..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack/config.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-module Rack
- # Rack::Config modifies the environment using the block given during
- # initialization.
- class Config
- def initialize(app, &block)
- @app = app
- @block = block
- end
-
- def call(env)
- @block.call(env)
- @app.call(env)
- end
- end
-end
diff --git a/vendor/gems/rack-1.1.0/lib/rack/content_length.rb b/vendor/gems/rack-1.1.0/lib/rack/content_length.rb
deleted file mode 100644
index 1e56d438..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack/content_length.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-require 'rack/utils'
-
-module Rack
- # Sets the Content-Length header on responses with fixed-length bodies.
- class ContentLength
- include Rack::Utils
-
- def initialize(app)
- @app = app
- end
-
- def call(env)
- status, headers, body = @app.call(env)
- headers = HeaderHash.new(headers)
-
- if !STATUS_WITH_NO_ENTITY_BODY.include?(status) &&
- !headers['Content-Length'] &&
- !headers['Transfer-Encoding'] &&
- (body.respond_to?(:to_ary) || body.respond_to?(:to_str))
-
- body = [body] if body.respond_to?(:to_str) # rack 0.4 compat
- length = body.to_ary.inject(0) { |len, part| len + bytesize(part) }
- headers['Content-Length'] = length.to_s
- end
-
- [status, headers, body]
- end
- end
-end
diff --git a/vendor/gems/rack-1.1.0/lib/rack/content_type.rb b/vendor/gems/rack-1.1.0/lib/rack/content_type.rb
deleted file mode 100644
index 874c28cd..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack/content_type.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-require 'rack/utils'
-
-module Rack
-
- # Sets the Content-Type header on responses which don't have one.
- #
- # Builder Usage:
- # use Rack::ContentType, "text/plain"
- #
- # When no content type argument is provided, "text/html" is assumed.
- class ContentType
- def initialize(app, content_type = "text/html")
- @app, @content_type = app, content_type
- end
-
- def call(env)
- status, headers, body = @app.call(env)
- headers = Utils::HeaderHash.new(headers)
- headers['Content-Type'] ||= @content_type
- [status, headers, body]
- end
- end
-end
diff --git a/vendor/gems/rack-1.1.0/lib/rack/deflater.rb b/vendor/gems/rack-1.1.0/lib/rack/deflater.rb
deleted file mode 100644
index ad0f5316..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack/deflater.rb
+++ /dev/null
@@ -1,96 +0,0 @@
-require "zlib"
-require "stringio"
-require "time" # for Time.httpdate
-require 'rack/utils'
-
-module Rack
- class Deflater
- def initialize(app)
- @app = app
- end
-
- def call(env)
- status, headers, body = @app.call(env)
- headers = Utils::HeaderHash.new(headers)
-
- # Skip compressing empty entity body responses and responses with
- # no-transform set.
- if Utils::STATUS_WITH_NO_ENTITY_BODY.include?(status) ||
- headers['Cache-Control'].to_s =~ /\bno-transform\b/
- return [status, headers, body]
- end
-
- request = Request.new(env)
-
- encoding = Utils.select_best_encoding(%w(gzip deflate identity),
- request.accept_encoding)
-
- # Set the Vary HTTP header.
- vary = headers["Vary"].to_s.split(",").map { |v| v.strip }
- unless vary.include?("*") || vary.include?("Accept-Encoding")
- headers["Vary"] = vary.push("Accept-Encoding").join(",")
- end
-
- case encoding
- when "gzip"
- headers['Content-Encoding'] = "gzip"
- headers.delete('Content-Length')
- mtime = headers.key?("Last-Modified") ?
- Time.httpdate(headers["Last-Modified"]) : Time.now
- [status, headers, GzipStream.new(body, mtime)]
- when "deflate"
- headers['Content-Encoding'] = "deflate"
- headers.delete('Content-Length')
- [status, headers, DeflateStream.new(body)]
- when "identity"
- [status, headers, body]
- when nil
- message = "An acceptable encoding for the requested resource #{request.fullpath} could not be found."
- [406, {"Content-Type" => "text/plain", "Content-Length" => message.length.to_s}, [message]]
- end
- end
-
- class GzipStream
- def initialize(body, mtime)
- @body = body
- @mtime = mtime
- end
-
- def each(&block)
- @writer = block
- gzip =::Zlib::GzipWriter.new(self)
- gzip.mtime = @mtime
- @body.each { |part| gzip.write(part) }
- @body.close if @body.respond_to?(:close)
- gzip.close
- @writer = nil
- end
-
- def write(data)
- @writer.call(data)
- end
- end
-
- class DeflateStream
- DEFLATE_ARGS = [
- Zlib::DEFAULT_COMPRESSION,
- # drop the zlib header which causes both Safari and IE to choke
- -Zlib::MAX_WBITS,
- Zlib::DEF_MEM_LEVEL,
- Zlib::DEFAULT_STRATEGY
- ]
-
- def initialize(body)
- @body = body
- end
-
- def each
- deflater = ::Zlib::Deflate.new(*DEFLATE_ARGS)
- @body.each { |part| yield deflater.deflate(part) }
- @body.close if @body.respond_to?(:close)
- yield deflater.finish
- nil
- end
- end
- end
-end
diff --git a/vendor/gems/rack-1.1.0/lib/rack/directory.rb b/vendor/gems/rack-1.1.0/lib/rack/directory.rb
deleted file mode 100644
index 927ac0c9..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack/directory.rb
+++ /dev/null
@@ -1,157 +0,0 @@
-require 'time'
-require 'rack/utils'
-require 'rack/mime'
-
-module Rack
- # Rack::Directory serves entries below the +root+ given, according to the
- # path info of the Rack request. If a directory is found, the file's contents
- # will be presented in an html based index. If a file is found, the env will
- # be passed to the specified +app+.
- #
- # If +app+ is not specified, a Rack::File of the same +root+ will be used.
-
- class Directory
- DIR_FILE = "| %s | %s | %s | %s |
"
- DIR_PAGE = <<-PAGE
-
- %s
-
-
-
-%s
-
-
-
- | Name |
- Size |
- Type |
- Last Modified |
-
-%s
-
-
-
- PAGE
-
- attr_reader :files
- attr_accessor :root, :path
-
- def initialize(root, app=nil)
- @root = F.expand_path(root)
- @app = app || Rack::File.new(@root)
- end
-
- def call(env)
- dup._call(env)
- end
-
- F = ::File
-
- def _call(env)
- @env = env
- @script_name = env['SCRIPT_NAME']
- @path_info = Utils.unescape(env['PATH_INFO'])
-
- if forbidden = check_forbidden
- forbidden
- else
- @path = F.join(@root, @path_info)
- list_path
- end
- end
-
- def check_forbidden
- return unless @path_info.include? ".."
-
- body = "Forbidden\n"
- size = Rack::Utils.bytesize(body)
- return [403, {"Content-Type" => "text/plain",
- "Content-Length" => size.to_s,
- "X-Cascade" => "pass"}, [body]]
- end
-
- def list_directory
- @files = [['../','Parent Directory','','','']]
- glob = F.join(@path, '*')
-
- Dir[glob].sort.each do |node|
- stat = stat(node)
- next unless stat
- basename = F.basename(node)
- ext = F.extname(node)
-
- url = F.join(@script_name, @path_info, basename)
- size = stat.size
- type = stat.directory? ? 'directory' : Mime.mime_type(ext)
- size = stat.directory? ? '-' : filesize_format(size)
- mtime = stat.mtime.httpdate
- url << '/' if stat.directory?
- basename << '/' if stat.directory?
-
- @files << [ url, basename, size, type, mtime ]
- end
-
- return [ 200, {'Content-Type'=>'text/html; charset=utf-8'}, self ]
- end
-
- def stat(node, max = 10)
- F.stat(node)
- rescue Errno::ENOENT, Errno::ELOOP
- return nil
- end
-
- # TODO: add correct response if not readable, not sure if 404 is the best
- # option
- def list_path
- @stat = F.stat(@path)
-
- if @stat.readable?
- return @app.call(@env) if @stat.file?
- return list_directory if @stat.directory?
- else
- raise Errno::ENOENT, 'No such file or directory'
- end
-
- rescue Errno::ENOENT, Errno::ELOOP
- return entity_not_found
- end
-
- def entity_not_found
- body = "Entity not found: #{@path_info}\n"
- size = Rack::Utils.bytesize(body)
- return [404, {"Content-Type" => "text/plain",
- "Content-Length" => size.to_s,
- "X-Cascade" => "pass"}, [body]]
- end
-
- def each
- show_path = @path.sub(/^#{@root}/,'')
- files = @files.map{|f| DIR_FILE % f }*"\n"
- page = DIR_PAGE % [ show_path, show_path , files ]
- page.each_line{|l| yield l }
- end
-
- # Stolen from Ramaze
-
- FILESIZE_FORMAT = [
- ['%.1fT', 1 << 40],
- ['%.1fG', 1 << 30],
- ['%.1fM', 1 << 20],
- ['%.1fK', 1 << 10],
- ]
-
- def filesize_format(int)
- FILESIZE_FORMAT.each do |format, size|
- return format % (int.to_f / size) if int >= size
- end
-
- int.to_s + 'B'
- end
- end
-end
diff --git a/vendor/gems/rack-1.1.0/lib/rack/etag.rb b/vendor/gems/rack-1.1.0/lib/rack/etag.rb
deleted file mode 100644
index 06dbc6aa..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack/etag.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-require 'digest/md5'
-
-module Rack
- # Automatically sets the ETag header on all String bodies
- class ETag
- def initialize(app)
- @app = app
- end
-
- def call(env)
- status, headers, body = @app.call(env)
-
- if !headers.has_key?('ETag')
- parts = []
- body.each { |part| parts << part.to_s }
- headers['ETag'] = %("#{Digest::MD5.hexdigest(parts.join(""))}")
- [status, headers, parts]
- else
- [status, headers, body]
- end
- end
- end
-end
diff --git a/vendor/gems/rack-1.1.0/lib/rack/file.rb b/vendor/gems/rack-1.1.0/lib/rack/file.rb
deleted file mode 100644
index 14af7b3b..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack/file.rb
+++ /dev/null
@@ -1,90 +0,0 @@
-require 'time'
-require 'rack/utils'
-require 'rack/mime'
-
-module Rack
- # Rack::File serves files below the +root+ given, according to the
- # path info of the Rack request.
- #
- # Handlers can detect if bodies are a Rack::File, and use mechanisms
- # like sendfile on the +path+.
-
- class File
- attr_accessor :root
- attr_accessor :path
-
- alias :to_path :path
-
- def initialize(root)
- @root = root
- end
-
- def call(env)
- dup._call(env)
- end
-
- F = ::File
-
- def _call(env)
- @path_info = Utils.unescape(env["PATH_INFO"])
- return forbidden if @path_info.include? ".."
-
- @path = F.join(@root, @path_info)
-
- begin
- if F.file?(@path) && F.readable?(@path)
- serving
- else
- raise Errno::EPERM
- end
- rescue SystemCallError
- not_found
- end
- end
-
- def forbidden
- body = "Forbidden\n"
- [403, {"Content-Type" => "text/plain",
- "Content-Length" => body.size.to_s,
- "X-Cascade" => "pass"},
- [body]]
- end
-
- # NOTE:
- # We check via File::size? whether this file provides size info
- # via stat (e.g. /proc files often don't), otherwise we have to
- # figure it out by reading the whole file into memory. And while
- # we're at it we also use this as body then.
-
- def serving
- if size = F.size?(@path)
- body = self
- else
- body = [F.read(@path)]
- size = Utils.bytesize(body.first)
- end
-
- [200, {
- "Last-Modified" => F.mtime(@path).httpdate,
- "Content-Type" => Mime.mime_type(F.extname(@path), 'text/plain'),
- "Content-Length" => size.to_s
- }, body]
- end
-
- def not_found
- body = "File not found: #{@path_info}\n"
- [404, {"Content-Type" => "text/plain",
- "Content-Length" => body.size.to_s,
- "X-Cascade" => "pass"},
- [body]]
- end
-
- def each
- F.open(@path, "rb") { |file|
- while part = file.read(8192)
- yield part
- end
- }
- end
- end
-end
diff --git a/vendor/gems/rack-1.1.0/lib/rack/handler.rb b/vendor/gems/rack-1.1.0/lib/rack/handler.rb
deleted file mode 100644
index 3c09883e..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack/handler.rb
+++ /dev/null
@@ -1,88 +0,0 @@
-module Rack
- # *Handlers* connect web servers with Rack.
- #
- # Rack includes Handlers for Mongrel, WEBrick, FastCGI, CGI, SCGI
- # and LiteSpeed.
- #
- # Handlers usually are activated by calling MyHandler.run(myapp).
- # A second optional hash can be passed to include server-specific
- # configuration.
- module Handler
- def self.get(server)
- return unless server
- server = server.to_s
-
- if klass = @handlers[server]
- obj = Object
- klass.split("::").each { |x| obj = obj.const_get(x) }
- obj
- else
- try_require('rack/handler', server)
- const_get(server)
- end
- end
-
- def self.default(options = {})
- # Guess.
- if ENV.include?("PHP_FCGI_CHILDREN")
- # We already speak FastCGI
- options.delete :File
- options.delete :Port
-
- Rack::Handler::FastCGI
- elsif ENV.include?("REQUEST_METHOD")
- Rack::Handler::CGI
- else
- begin
- Rack::Handler::Mongrel
- rescue LoadError => e
- Rack::Handler::WEBrick
- end
- end
- end
-
- # Transforms server-name constants to their canonical form as filenames,
- # then tries to require them but silences the LoadError if not found
- #
- # Naming convention:
- #
- # Foo # => 'foo'
- # FooBar # => 'foo_bar.rb'
- # FooBAR # => 'foobar.rb'
- # FOObar # => 'foobar.rb'
- # FOOBAR # => 'foobar.rb'
- # FooBarBaz # => 'foo_bar_baz.rb'
- def self.try_require(prefix, const_name)
- file = const_name.gsub(/^[A-Z]+/) { |pre| pre.downcase }.
- gsub(/[A-Z]+[^A-Z]/, '_\&').downcase
-
- require(::File.join(prefix, file))
- rescue LoadError
- end
-
- def self.register(server, klass)
- @handlers ||= {}
- @handlers[server] = klass
- end
-
- autoload :CGI, "rack/handler/cgi"
- autoload :FastCGI, "rack/handler/fastcgi"
- autoload :Mongrel, "rack/handler/mongrel"
- autoload :EventedMongrel, "rack/handler/evented_mongrel"
- autoload :SwiftipliedMongrel, "rack/handler/swiftiplied_mongrel"
- autoload :WEBrick, "rack/handler/webrick"
- autoload :LSWS, "rack/handler/lsws"
- autoload :SCGI, "rack/handler/scgi"
- autoload :Thin, "rack/handler/thin"
-
- register 'cgi', 'Rack::Handler::CGI'
- register 'fastcgi', 'Rack::Handler::FastCGI'
- register 'mongrel', 'Rack::Handler::Mongrel'
- register 'emongrel', 'Rack::Handler::EventedMongrel'
- register 'smongrel', 'Rack::Handler::SwiftipliedMongrel'
- register 'webrick', 'Rack::Handler::WEBrick'
- register 'lsws', 'Rack::Handler::LSWS'
- register 'scgi', 'Rack::Handler::SCGI'
- register 'thin', 'Rack::Handler::Thin'
- end
-end
diff --git a/vendor/gems/rack-1.1.0/lib/rack/handler/cgi.rb b/vendor/gems/rack-1.1.0/lib/rack/handler/cgi.rb
deleted file mode 100644
index c6903f15..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack/handler/cgi.rb
+++ /dev/null
@@ -1,61 +0,0 @@
-require 'rack/content_length'
-
-module Rack
- module Handler
- class CGI
- def self.run(app, options=nil)
- serve app
- end
-
- def self.serve(app)
- app = ContentLength.new(app)
-
- env = ENV.to_hash
- env.delete "HTTP_CONTENT_LENGTH"
-
- env["SCRIPT_NAME"] = "" if env["SCRIPT_NAME"] == "/"
-
- env.update({"rack.version" => [1,1],
- "rack.input" => $stdin,
- "rack.errors" => $stderr,
-
- "rack.multithread" => false,
- "rack.multiprocess" => true,
- "rack.run_once" => true,
-
- "rack.url_scheme" => ["yes", "on", "1"].include?(ENV["HTTPS"]) ? "https" : "http"
- })
-
- env["QUERY_STRING"] ||= ""
- env["HTTP_VERSION"] ||= env["SERVER_PROTOCOL"]
- env["REQUEST_PATH"] ||= "/"
-
- status, headers, body = app.call(env)
- begin
- send_headers status, headers
- send_body body
- ensure
- body.close if body.respond_to? :close
- end
- end
-
- def self.send_headers(status, headers)
- STDOUT.print "Status: #{status}\r\n"
- headers.each { |k, vs|
- vs.split("\n").each { |v|
- STDOUT.print "#{k}: #{v}\r\n"
- }
- }
- STDOUT.print "\r\n"
- STDOUT.flush
- end
-
- def self.send_body(body)
- body.each { |part|
- STDOUT.print part
- STDOUT.flush
- }
- end
- end
- end
-end
diff --git a/vendor/gems/rack-1.1.0/lib/rack/handler/evented_mongrel.rb b/vendor/gems/rack-1.1.0/lib/rack/handler/evented_mongrel.rb
deleted file mode 100644
index 0f5cbf72..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack/handler/evented_mongrel.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-require 'swiftcore/evented_mongrel'
-
-module Rack
- module Handler
- class EventedMongrel < Handler::Mongrel
- end
- end
-end
diff --git a/vendor/gems/rack-1.1.0/lib/rack/handler/fastcgi.rb b/vendor/gems/rack-1.1.0/lib/rack/handler/fastcgi.rb
deleted file mode 100644
index b992a5f4..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack/handler/fastcgi.rb
+++ /dev/null
@@ -1,89 +0,0 @@
-require 'fcgi'
-require 'socket'
-require 'rack/content_length'
-require 'rack/rewindable_input'
-
-if defined? FCGI::Stream
- class FCGI::Stream
- alias _rack_read_without_buffer read
-
- def read(n, buffer=nil)
- buf = _rack_read_without_buffer n
- buffer.replace(buf.to_s) if buffer
- buf
- end
- end
-end
-
-module Rack
- module Handler
- class FastCGI
- def self.run(app, options={})
- file = options[:File] and STDIN.reopen(UNIXServer.new(file))
- port = options[:Port] and STDIN.reopen(TCPServer.new(port))
- FCGI.each { |request|
- serve request, app
- }
- end
-
- def self.serve(request, app)
- app = Rack::ContentLength.new(app)
-
- env = request.env
- env.delete "HTTP_CONTENT_LENGTH"
-
- env["SCRIPT_NAME"] = "" if env["SCRIPT_NAME"] == "/"
-
- rack_input = RewindableInput.new(request.in)
-
- env.update({"rack.version" => [1,1],
- "rack.input" => rack_input,
- "rack.errors" => request.err,
-
- "rack.multithread" => false,
- "rack.multiprocess" => true,
- "rack.run_once" => false,
-
- "rack.url_scheme" => ["yes", "on", "1"].include?(env["HTTPS"]) ? "https" : "http"
- })
-
- env["QUERY_STRING"] ||= ""
- env["HTTP_VERSION"] ||= env["SERVER_PROTOCOL"]
- env["REQUEST_PATH"] ||= "/"
- env.delete "CONTENT_TYPE" if env["CONTENT_TYPE"] == ""
- env.delete "CONTENT_LENGTH" if env["CONTENT_LENGTH"] == ""
-
- begin
- status, headers, body = app.call(env)
- begin
- send_headers request.out, status, headers
- send_body request.out, body
- ensure
- body.close if body.respond_to? :close
- end
- ensure
- rack_input.close
- request.finish
- end
- end
-
- def self.send_headers(out, status, headers)
- out.print "Status: #{status}\r\n"
- headers.each { |k, vs|
- vs.split("\n").each { |v|
- out.print "#{k}: #{v}\r\n"
- }
- }
- out.print "\r\n"
- out.flush
- end
-
- def self.send_body(out, body)
- body.each { |part|
- out.print part
- out.flush
- }
- end
- end
- end
-end
diff --git a/vendor/gems/rack-1.1.0/lib/rack/handler/lsws.rb b/vendor/gems/rack-1.1.0/lib/rack/handler/lsws.rb
deleted file mode 100644
index eabc0bc9..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack/handler/lsws.rb
+++ /dev/null
@@ -1,63 +0,0 @@
-require 'lsapi'
-require 'rack/content_length'
-require 'rack/rewindable_input'
-
-module Rack
- module Handler
- class LSWS
- def self.run(app, options=nil)
- while LSAPI.accept != nil
- serve app
- end
- end
- def self.serve(app)
- app = Rack::ContentLength.new(app)
-
- env = ENV.to_hash
- env.delete "HTTP_CONTENT_LENGTH"
- env["SCRIPT_NAME"] = "" if env["SCRIPT_NAME"] == "/"
-
- rack_input = RewindableInput.new($stdin.read.to_s)
-
- env.update(
- "rack.version" => [1,1],
- "rack.input" => rack_input,
- "rack.errors" => $stderr,
- "rack.multithread" => false,
- "rack.multiprocess" => true,
- "rack.run_once" => false,
- "rack.url_scheme" => ["yes", "on", "1"].include?(ENV["HTTPS"]) ? "https" : "http"
- )
-
- env["QUERY_STRING"] ||= ""
- env["HTTP_VERSION"] ||= env["SERVER_PROTOCOL"]
- env["REQUEST_PATH"] ||= "/"
- status, headers, body = app.call(env)
- begin
- send_headers status, headers
- send_body body
- ensure
- body.close if body.respond_to? :close
- end
- ensure
- rack_input.close
- end
- def self.send_headers(status, headers)
- print "Status: #{status}\r\n"
- headers.each { |k, vs|
- vs.split("\n").each { |v|
- print "#{k}: #{v}\r\n"
- }
- }
- print "\r\n"
- STDOUT.flush
- end
- def self.send_body(body)
- body.each { |part|
- print part
- STDOUT.flush
- }
- end
- end
- end
-end
diff --git a/vendor/gems/rack-1.1.0/lib/rack/handler/mongrel.rb b/vendor/gems/rack-1.1.0/lib/rack/handler/mongrel.rb
deleted file mode 100644
index b6b775ea..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack/handler/mongrel.rb
+++ /dev/null
@@ -1,90 +0,0 @@
-require 'mongrel'
-require 'stringio'
-require 'rack/content_length'
-require 'rack/chunked'
-
-module Rack
- module Handler
- class Mongrel < ::Mongrel::HttpHandler
- def self.run(app, options={})
- server = ::Mongrel::HttpServer.new(
- options[:Host] || '0.0.0.0',
- options[:Port] || 8080,
- options[:num_processors] || 950,
- options[:throttle] || 0,
- options[:timeout] || 60)
- # Acts like Rack::URLMap, utilizing Mongrel's own path finding methods.
- # Use is similar to #run, replacing the app argument with a hash of
- # { path=>app, ... } or an instance of Rack::URLMap.
- if options[:map]
- if app.is_a? Hash
- app.each do |path, appl|
- path = '/'+path unless path[0] == ?/
- server.register(path, Rack::Handler::Mongrel.new(appl))
- end
- elsif app.is_a? URLMap
- app.instance_variable_get(:@mapping).each do |(host, path, appl)|
- next if !host.nil? && !options[:Host].nil? && options[:Host] != host
- path = '/'+path unless path[0] == ?/
- server.register(path, Rack::Handler::Mongrel.new(appl))
- end
- else
- raise ArgumentError, "first argument should be a Hash or URLMap"
- end
- else
- server.register('/', Rack::Handler::Mongrel.new(app))
- end
- yield server if block_given?
- server.run.join
- end
-
- def initialize(app)
- @app = Rack::Chunked.new(Rack::ContentLength.new(app))
- end
-
- def process(request, response)
- env = {}.replace(request.params)
- env.delete "HTTP_CONTENT_TYPE"
- env.delete "HTTP_CONTENT_LENGTH"
-
- env["SCRIPT_NAME"] = "" if env["SCRIPT_NAME"] == "/"
-
- rack_input = request.body || StringIO.new('')
- rack_input.set_encoding(Encoding::BINARY) if rack_input.respond_to?(:set_encoding)
-
- env.update({"rack.version" => [1,1],
- "rack.input" => rack_input,
- "rack.errors" => $stderr,
-
- "rack.multithread" => true,
- "rack.multiprocess" => false, # ???
- "rack.run_once" => false,
-
- "rack.url_scheme" => "http",
- })
- env["QUERY_STRING"] ||= ""
-
- status, headers, body = @app.call(env)
-
- begin
- response.status = status.to_i
- response.send_status(nil)
-
- headers.each { |k, vs|
- vs.split("\n").each { |v|
- response.header[k] = v
- }
- }
- response.send_header
-
- body.each { |part|
- response.write part
- response.socket.flush
- }
- ensure
- body.close if body.respond_to? :close
- end
- end
- end
- end
-end
diff --git a/vendor/gems/rack-1.1.0/lib/rack/handler/scgi.rb b/vendor/gems/rack-1.1.0/lib/rack/handler/scgi.rb
deleted file mode 100644
index 79a6b2bd..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack/handler/scgi.rb
+++ /dev/null
@@ -1,62 +0,0 @@
-require 'scgi'
-require 'stringio'
-require 'rack/content_length'
-require 'rack/chunked'
-
-module Rack
- module Handler
- class SCGI < ::SCGI::Processor
- attr_accessor :app
-
- def self.run(app, options=nil)
- new(options.merge(:app=>app,
- :host=>options[:Host],
- :port=>options[:Port],
- :socket=>options[:Socket])).listen
- end
-
- def initialize(settings = {})
- @app = Rack::Chunked.new(Rack::ContentLength.new(settings[:app]))
- @log = Object.new
- def @log.info(*args); end
- def @log.error(*args); end
- super(settings)
- end
-
- def process_request(request, input_body, socket)
- env = {}.replace(request)
- env.delete "HTTP_CONTENT_TYPE"
- env.delete "HTTP_CONTENT_LENGTH"
- env["REQUEST_PATH"], env["QUERY_STRING"] = env["REQUEST_URI"].split('?', 2)
- env["HTTP_VERSION"] ||= env["SERVER_PROTOCOL"]
- env["PATH_INFO"] = env["REQUEST_PATH"]
- env["QUERY_STRING"] ||= ""
- env["SCRIPT_NAME"] = ""
-
- rack_input = StringIO.new(input_body)
- rack_input.set_encoding(Encoding::BINARY) if rack_input.respond_to?(:set_encoding)
-
- env.update({"rack.version" => [1,1],
- "rack.input" => rack_input,
- "rack.errors" => $stderr,
- "rack.multithread" => true,
- "rack.multiprocess" => true,
- "rack.run_once" => false,
-
- "rack.url_scheme" => ["yes", "on", "1"].include?(env["HTTPS"]) ? "https" : "http"
- })
- status, headers, body = app.call(env)
- begin
- socket.write("Status: #{status}\r\n")
- headers.each do |k, vs|
- vs.split("\n").each { |v| socket.write("#{k}: #{v}\r\n")}
- end
- socket.write("\r\n")
- body.each {|s| socket.write(s)}
- ensure
- body.close if body.respond_to? :close
- end
- end
- end
- end
-end
diff --git a/vendor/gems/rack-1.1.0/lib/rack/handler/swiftiplied_mongrel.rb b/vendor/gems/rack-1.1.0/lib/rack/handler/swiftiplied_mongrel.rb
deleted file mode 100644
index 4bafd0b9..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack/handler/swiftiplied_mongrel.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-require 'swiftcore/swiftiplied_mongrel'
-
-module Rack
- module Handler
- class SwiftipliedMongrel < Handler::Mongrel
- end
- end
-end
diff --git a/vendor/gems/rack-1.1.0/lib/rack/handler/thin.rb b/vendor/gems/rack-1.1.0/lib/rack/handler/thin.rb
deleted file mode 100644
index 3d4fedff..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack/handler/thin.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-require "thin"
-require "rack/content_length"
-require "rack/chunked"
-
-module Rack
- module Handler
- class Thin
- def self.run(app, options={})
- app = Rack::Chunked.new(Rack::ContentLength.new(app))
- server = ::Thin::Server.new(options[:Host] || '0.0.0.0',
- options[:Port] || 8080,
- app)
- yield server if block_given?
- server.start
- end
- end
- end
-end
diff --git a/vendor/gems/rack-1.1.0/lib/rack/handler/webrick.rb b/vendor/gems/rack-1.1.0/lib/rack/handler/webrick.rb
deleted file mode 100644
index 8d7f5724..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack/handler/webrick.rb
+++ /dev/null
@@ -1,69 +0,0 @@
-require 'webrick'
-require 'stringio'
-require 'rack/content_length'
-
-module Rack
- module Handler
- class WEBrick < ::WEBrick::HTTPServlet::AbstractServlet
- def self.run(app, options={})
- options[:BindAddress] = options.delete(:Host) if options[:Host]
- server = ::WEBrick::HTTPServer.new(options)
- server.mount "/", Rack::Handler::WEBrick, app
- trap(:INT) { server.shutdown }
- yield server if block_given?
- server.start
- end
-
- def initialize(server, app)
- super server
- @app = Rack::ContentLength.new(app)
- end
-
- def service(req, res)
- env = req.meta_vars
- env.delete_if { |k, v| v.nil? }
-
- rack_input = StringIO.new(req.body.to_s)
- rack_input.set_encoding(Encoding::BINARY) if rack_input.respond_to?(:set_encoding)
-
- env.update({"rack.version" => [1,1],
- "rack.input" => rack_input,
- "rack.errors" => $stderr,
-
- "rack.multithread" => true,
- "rack.multiprocess" => false,
- "rack.run_once" => false,
-
- "rack.url_scheme" => ["yes", "on", "1"].include?(ENV["HTTPS"]) ? "https" : "http"
- })
-
- env["HTTP_VERSION"] ||= env["SERVER_PROTOCOL"]
- env["QUERY_STRING"] ||= ""
- env["REQUEST_PATH"] ||= "/"
- unless env["PATH_INFO"] == ""
- path, n = req.request_uri.path, env["SCRIPT_NAME"].length
- env["PATH_INFO"] = path[n, path.length-n]
- end
-
- status, headers, body = @app.call(env)
- begin
- res.status = status.to_i
- headers.each { |k, vs|
- if k.downcase == "set-cookie"
- res.cookies.concat vs.split("\n")
- else
- vs.split("\n").each { |v|
- res[k] = v
- }
- end
- }
- body.each { |part|
- res.body << part
- }
- ensure
- body.close if body.respond_to? :close
- end
- end
- end
- end
-end
diff --git a/vendor/gems/rack-1.1.0/lib/rack/head.rb b/vendor/gems/rack-1.1.0/lib/rack/head.rb
deleted file mode 100644
index deab822a..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack/head.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-module Rack
-
-class Head
- def initialize(app)
- @app = app
- end
-
- def call(env)
- status, headers, body = @app.call(env)
-
- if env["REQUEST_METHOD"] == "HEAD"
- [status, headers, []]
- else
- [status, headers, body]
- end
- end
-end
-
-end
diff --git a/vendor/gems/rack-1.1.0/lib/rack/lint.rb b/vendor/gems/rack-1.1.0/lib/rack/lint.rb
deleted file mode 100644
index 534375b9..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack/lint.rb
+++ /dev/null
@@ -1,575 +0,0 @@
-require 'rack/utils'
-
-module Rack
- # Rack::Lint validates your application and the requests and
- # responses according to the Rack spec.
-
- class Lint
- def initialize(app)
- @app = app
- end
-
- # :stopdoc:
-
- class LintError < RuntimeError; end
- module Assertion
- def assert(message, &block)
- unless block.call
- raise LintError, message
- end
- end
- end
- include Assertion
-
- ## This specification aims to formalize the Rack protocol. You
- ## can (and should) use Rack::Lint to enforce it.
- ##
- ## When you develop middleware, be sure to add a Lint before and
- ## after to catch all mistakes.
-
- ## = Rack applications
-
- ## A Rack application is an Ruby object (not a class) that
- ## responds to +call+.
- def call(env=nil)
- dup._call(env)
- end
-
- def _call(env)
- ## It takes exactly one argument, the *environment*
- assert("No env given") { env }
- check_env env
-
- env['rack.input'] = InputWrapper.new(env['rack.input'])
- env['rack.errors'] = ErrorWrapper.new(env['rack.errors'])
-
- ## and returns an Array of exactly three values:
- status, headers, @body = @app.call(env)
- ## The *status*,
- check_status status
- ## the *headers*,
- check_headers headers
- ## and the *body*.
- check_content_type status, headers
- check_content_length status, headers, env
- [status, headers, self]
- end
-
- ## == The Environment
- def check_env(env)
- ## The environment must be an true instance of Hash (no
- ## subclassing allowed) that includes CGI-like headers.
- ## The application is free to modify the environment.
- assert("env #{env.inspect} is not a Hash, but #{env.class}") {
- env.kind_of? Hash
- }
-
- ##
- ## The environment is required to include these variables
- ## (adopted from PEP333), except when they'd be empty, but see
- ## below.
-
- ## REQUEST_METHOD:: The HTTP request method, such as
- ## "GET" or "POST". This cannot ever
- ## be an empty string, and so is
- ## always required.
-
- ## SCRIPT_NAME:: The initial portion of the request
- ## URL's "path" that corresponds to the
- ## application object, so that the
- ## application knows its virtual
- ## "location". This may be an empty
- ## string, if the application corresponds
- ## to the "root" of the server.
-
- ## PATH_INFO:: The remainder of the request URL's
- ## "path", designating the virtual
- ## "location" of the request's target
- ## within the application. This may be an
- ## empty string, if the request URL targets
- ## the application root and does not have a
- ## trailing slash. This value may be
- ## percent-encoded when I originating from
- ## a URL.
-
- ## QUERY_STRING:: The portion of the request URL that
- ## follows the ?, if any. May be
- ## empty, but is always required!
-
- ## SERVER_NAME, SERVER_PORT:: When combined with SCRIPT_NAME and PATH_INFO, these variables can be used to complete the URL. Note, however, that HTTP_HOST, if present, should be used in preference to SERVER_NAME for reconstructing the request URL. SERVER_NAME and SERVER_PORT can never be empty strings, and so are always required.
-
- ## HTTP_ Variables:: Variables corresponding to the
- ## client-supplied HTTP request
- ## headers (i.e., variables whose
- ## names begin with HTTP_). The
- ## presence or absence of these
- ## variables should correspond with
- ## the presence or absence of the
- ## appropriate HTTP header in the
- ## request.
-
- ## In addition to this, the Rack environment must include these
- ## Rack-specific variables:
-
- ## rack.version:: The Array [1,1], representing this version of Rack.
- ## rack.url_scheme:: +http+ or +https+, depending on the request URL.
- ## rack.input:: See below, the input stream.
- ## rack.errors:: See below, the error stream.
- ## rack.multithread:: true if the application object may be simultaneously invoked by another thread in the same process, false otherwise.
- ## rack.multiprocess:: true if an equivalent application object may be simultaneously invoked by another process, false otherwise.
- ## rack.run_once:: true if the server expects (but does not guarantee!) that the application will only be invoked this one time during the life of its containing process. Normally, this will only be true for a server based on CGI (or something similar).
- ##
-
- ## Additional environment specifications have approved to
- ## standardized middleware APIs. None of these are required to
- ## be implemented by the server.
-
- ## rack.session:: A hash like interface for storing request session data.
- ## The store must implement:
- if session = env['rack.session']
- ## store(key, value) (aliased as []=);
- assert("session #{session.inspect} must respond to store and []=") {
- session.respond_to?(:store) && session.respond_to?(:[]=)
- }
-
- ## fetch(key, default = nil) (aliased as []);
- assert("session #{session.inspect} must respond to fetch and []") {
- session.respond_to?(:fetch) && session.respond_to?(:[])
- }
-
- ## delete(key);
- assert("session #{session.inspect} must respond to delete") {
- session.respond_to?(:delete)
- }
-
- ## clear;
- assert("session #{session.inspect} must respond to clear") {
- session.respond_to?(:clear)
- }
- end
-
- ## rack.logger:: A common object interface for logging messages.
- ## The object must implement:
- if logger = env['rack.logger']
- ## info(message, &block)
- assert("logger #{logger.inspect} must respond to info") {
- logger.respond_to?(:info)
- }
-
- ## debug(message, &block)
- assert("logger #{logger.inspect} must respond to debug") {
- logger.respond_to?(:debug)
- }
-
- ## warn(message, &block)
- assert("logger #{logger.inspect} must respond to warn") {
- logger.respond_to?(:warn)
- }
-
- ## error(message, &block)
- assert("logger #{logger.inspect} must respond to error") {
- logger.respond_to?(:error)
- }
-
- ## fatal(message, &block)
- assert("logger #{logger.inspect} must respond to fatal") {
- logger.respond_to?(:fatal)
- }
- end
-
- ## The server or the application can store their own data in the
- ## environment, too. The keys must contain at least one dot,
- ## and should be prefixed uniquely. The prefix rack.
- ## is reserved for use with the Rack core distribution and other
- ## accepted specifications and must not be used otherwise.
- ##
-
- %w[REQUEST_METHOD SERVER_NAME SERVER_PORT
- QUERY_STRING
- rack.version rack.input rack.errors
- rack.multithread rack.multiprocess rack.run_once].each { |header|
- assert("env missing required key #{header}") { env.include? header }
- }
-
- ## The environment must not contain the keys
- ## HTTP_CONTENT_TYPE or HTTP_CONTENT_LENGTH
- ## (use the versions without HTTP_).
- %w[HTTP_CONTENT_TYPE HTTP_CONTENT_LENGTH].each { |header|
- assert("env contains #{header}, must use #{header[5,-1]}") {
- not env.include? header
- }
- }
-
- ## The CGI keys (named without a period) must have String values.
- env.each { |key, value|
- next if key.include? "." # Skip extensions
- assert("env variable #{key} has non-string value #{value.inspect}") {
- value.kind_of? String
- }
- }
-
- ##
- ## There are the following restrictions:
-
- ## * rack.version must be an array of Integers.
- assert("rack.version must be an Array, was #{env["rack.version"].class}") {
- env["rack.version"].kind_of? Array
- }
- ## * rack.url_scheme must either be +http+ or +https+.
- assert("rack.url_scheme unknown: #{env["rack.url_scheme"].inspect}") {
- %w[http https].include? env["rack.url_scheme"]
- }
-
- ## * There must be a valid input stream in rack.input.
- check_input env["rack.input"]
- ## * There must be a valid error stream in rack.errors.
- check_error env["rack.errors"]
-
- ## * The REQUEST_METHOD must be a valid token.
- assert("REQUEST_METHOD unknown: #{env["REQUEST_METHOD"]}") {
- env["REQUEST_METHOD"] =~ /\A[0-9A-Za-z!\#$%&'*+.^_`|~-]+\z/
- }
-
- ## * The SCRIPT_NAME, if non-empty, must start with /
- assert("SCRIPT_NAME must start with /") {
- !env.include?("SCRIPT_NAME") ||
- env["SCRIPT_NAME"] == "" ||
- env["SCRIPT_NAME"] =~ /\A\//
- }
- ## * The PATH_INFO, if non-empty, must start with /
- assert("PATH_INFO must start with /") {
- !env.include?("PATH_INFO") ||
- env["PATH_INFO"] == "" ||
- env["PATH_INFO"] =~ /\A\//
- }
- ## * The CONTENT_LENGTH, if given, must consist of digits only.
- assert("Invalid CONTENT_LENGTH: #{env["CONTENT_LENGTH"]}") {
- !env.include?("CONTENT_LENGTH") || env["CONTENT_LENGTH"] =~ /\A\d+\z/
- }
-
- ## * One of SCRIPT_NAME or PATH_INFO must be
- ## set. PATH_INFO should be / if
- ## SCRIPT_NAME is empty.
- assert("One of SCRIPT_NAME or PATH_INFO must be set (make PATH_INFO '/' if SCRIPT_NAME is empty)") {
- env["SCRIPT_NAME"] || env["PATH_INFO"]
- }
- ## SCRIPT_NAME never should be /, but instead be empty.
- assert("SCRIPT_NAME cannot be '/', make it '' and PATH_INFO '/'") {
- env["SCRIPT_NAME"] != "/"
- }
- end
-
- ## === The Input Stream
- ##
- ## The input stream is an IO-like object which contains the raw HTTP
- ## POST data.
- def check_input(input)
- ## When applicable, its external encoding must be "ASCII-8BIT" and it
- ## must be opened in binary mode, for Ruby 1.9 compatibility.
- assert("rack.input #{input} does not have ASCII-8BIT as its external encoding") {
- input.external_encoding.name == "ASCII-8BIT"
- } if input.respond_to?(:external_encoding)
- assert("rack.input #{input} is not opened in binary mode") {
- input.binmode?
- } if input.respond_to?(:binmode?)
-
- ## The input stream must respond to +gets+, +each+, +read+ and +rewind+.
- [:gets, :each, :read, :rewind].each { |method|
- assert("rack.input #{input} does not respond to ##{method}") {
- input.respond_to? method
- }
- }
- end
-
- class InputWrapper
- include Assertion
-
- def initialize(input)
- @input = input
- end
-
- def size
- @input.size
- end
-
- ## * +gets+ must be called without arguments and return a string,
- ## or +nil+ on EOF.
- def gets(*args)
- assert("rack.input#gets called with arguments") { args.size == 0 }
- v = @input.gets
- assert("rack.input#gets didn't return a String") {
- v.nil? or v.kind_of? String
- }
- v
- end
-
- ## * +read+ behaves like IO#read. Its signature is read([length, [buffer]]).
- ## If given, +length+ must be an non-negative Integer (>= 0) or +nil+, and +buffer+ must
- ## be a String and may not be nil. If +length+ is given and not nil, then this method
- ## reads at most +length+ bytes from the input stream. If +length+ is not given or nil,
- ## then this method reads all data until EOF.
- ## When EOF is reached, this method returns nil if +length+ is given and not nil, or ""
- ## if +length+ is not given or is nil.
- ## If +buffer+ is given, then the read data will be placed into +buffer+ instead of a
- ## newly created String object.
- def read(*args)
- assert("rack.input#read called with too many arguments") {
- args.size <= 2
- }
- if args.size >= 1
- assert("rack.input#read called with non-integer and non-nil length") {
- args.first.kind_of?(Integer) || args.first.nil?
- }
- assert("rack.input#read called with a negative length") {
- args.first.nil? || args.first >= 0
- }
- end
- if args.size >= 2
- assert("rack.input#read called with non-String buffer") {
- args[1].kind_of?(String)
- }
- end
-
- v = @input.read(*args)
-
- assert("rack.input#read didn't return nil or a String") {
- v.nil? or v.kind_of? String
- }
- if args[0].nil?
- assert("rack.input#read(nil) returned nil on EOF") {
- !v.nil?
- }
- end
-
- v
- end
-
- ## * +each+ must be called without arguments and only yield Strings.
- def each(*args)
- assert("rack.input#each called with arguments") { args.size == 0 }
- @input.each { |line|
- assert("rack.input#each didn't yield a String") {
- line.kind_of? String
- }
- yield line
- }
- end
-
- ## * +rewind+ must be called without arguments. It rewinds the input
- ## stream back to the beginning. It must not raise Errno::ESPIPE:
- ## that is, it may not be a pipe or a socket. Therefore, handler
- ## developers must buffer the input data into some rewindable object
- ## if the underlying input stream is not rewindable.
- def rewind(*args)
- assert("rack.input#rewind called with arguments") { args.size == 0 }
- assert("rack.input#rewind raised Errno::ESPIPE") {
- begin
- @input.rewind
- true
- rescue Errno::ESPIPE
- false
- end
- }
- end
-
- ## * +close+ must never be called on the input stream.
- def close(*args)
- assert("rack.input#close must not be called") { false }
- end
- end
-
- ## === The Error Stream
- def check_error(error)
- ## The error stream must respond to +puts+, +write+ and +flush+.
- [:puts, :write, :flush].each { |method|
- assert("rack.error #{error} does not respond to ##{method}") {
- error.respond_to? method
- }
- }
- end
-
- class ErrorWrapper
- include Assertion
-
- def initialize(error)
- @error = error
- end
-
- ## * +puts+ must be called with a single argument that responds to +to_s+.
- def puts(str)
- @error.puts str
- end
-
- ## * +write+ must be called with a single argument that is a String.
- def write(str)
- assert("rack.errors#write not called with a String") { str.kind_of? String }
- @error.write str
- end
-
- ## * +flush+ must be called without arguments and must be called
- ## in order to make the error appear for sure.
- def flush
- @error.flush
- end
-
- ## * +close+ must never be called on the error stream.
- def close(*args)
- assert("rack.errors#close must not be called") { false }
- end
- end
-
- ## == The Response
-
- ## === The Status
- def check_status(status)
- ## This is an HTTP status. When parsed as integer (+to_i+), it must be
- ## greater than or equal to 100.
- assert("Status must be >=100 seen as integer") { status.to_i >= 100 }
- end
-
- ## === The Headers
- def check_headers(header)
- ## The header must respond to +each+, and yield values of key and value.
- assert("headers object should respond to #each, but doesn't (got #{header.class} as headers)") {
- header.respond_to? :each
- }
- header.each { |key, value|
- ## The header keys must be Strings.
- assert("header key must be a string, was #{key.class}") {
- key.kind_of? String
- }
- ## The header must not contain a +Status+ key,
- assert("header must not contain Status") { key.downcase != "status" }
- ## contain keys with : or newlines in their name,
- assert("header names must not contain : or \\n") { key !~ /[:\n]/ }
- ## contain keys names that end in - or _,
- assert("header names must not end in - or _") { key !~ /[-_]\z/ }
- ## but only contain keys that consist of
- ## letters, digits, _ or - and start with a letter.
- assert("invalid header name: #{key}") { key =~ /\A[a-zA-Z][a-zA-Z0-9_-]*\z/ }
-
- ## The values of the header must be Strings,
- assert("a header value must be a String, but the value of " +
- "'#{key}' is a #{value.class}") { value.kind_of? String }
- ## consisting of lines (for multiple header values, e.g. multiple
- ## Set-Cookie values) seperated by "\n".
- value.split("\n").each { |item|
- ## The lines must not contain characters below 037.
- assert("invalid header value #{key}: #{item.inspect}") {
- item !~ /[\000-\037]/
- }
- }
- }
- end
-
- ## === The Content-Type
- def check_content_type(status, headers)
- headers.each { |key, value|
- ## There must be a Content-Type, except when the
- ## +Status+ is 1xx, 204 or 304, in which case there must be none
- ## given.
- if key.downcase == "content-type"
- assert("Content-Type header found in #{status} response, not allowed") {
- not Rack::Utils::STATUS_WITH_NO_ENTITY_BODY.include? status.to_i
- }
- return
- end
- }
- assert("No Content-Type header found") {
- Rack::Utils::STATUS_WITH_NO_ENTITY_BODY.include? status.to_i
- }
- end
-
- ## === The Content-Length
- def check_content_length(status, headers, env)
- headers.each { |key, value|
- if key.downcase == 'content-length'
- ## There must not be a Content-Length header when the
- ## +Status+ is 1xx, 204 or 304.
- assert("Content-Length header found in #{status} response, not allowed") {
- not Rack::Utils::STATUS_WITH_NO_ENTITY_BODY.include? status.to_i
- }
-
- bytes = 0
- string_body = true
-
- if @body.respond_to?(:to_ary)
- @body.each { |part|
- unless part.kind_of?(String)
- string_body = false
- break
- end
-
- bytes += Rack::Utils.bytesize(part)
- }
-
- if env["REQUEST_METHOD"] == "HEAD"
- assert("Response body was given for HEAD request, but should be empty") {
- bytes == 0
- }
- else
- if string_body
- assert("Content-Length header was #{value}, but should be #{bytes}") {
- value == bytes.to_s
- }
- end
- end
- end
-
- return
- end
- }
- end
-
- ## === The Body
- def each
- @closed = false
- ## The Body must respond to +each+
- @body.each { |part|
- ## and must only yield String values.
- assert("Body yielded non-string value #{part.inspect}") {
- part.kind_of? String
- }
- yield part
- }
- ##
- ## The Body itself should not be an instance of String, as this will
- ## break in Ruby 1.9.
- ##
- ## If the Body responds to +close+, it will be called after iteration.
- # XXX howto: assert("Body has not been closed") { @closed }
-
-
- ##
- ## If the Body responds to +to_path+, it must return a String
- ## identifying the location of a file whose contents are identical
- ## to that produced by calling +each+; this may be used by the
- ## server as an alternative, possibly more efficient way to
- ## transport the response.
-
- if @body.respond_to?(:to_path)
- assert("The file identified by body.to_path does not exist") {
- ::File.exist? @body.to_path
- }
- end
-
- ##
- ## The Body commonly is an Array of Strings, the application
- ## instance itself, or a File-like object.
- end
-
- def close
- @closed = true
- @body.close if @body.respond_to?(:close)
- end
-
- # :startdoc:
-
- end
-end
-
-## == Thanks
-## Some parts of this specification are adopted from PEP333: Python
-## Web Server Gateway Interface
-## v1.0 (http://www.python.org/dev/peps/pep-0333/). I'd like to thank
-## everyone involved in that effort.
diff --git a/vendor/gems/rack-1.1.0/lib/rack/lobster.rb b/vendor/gems/rack-1.1.0/lib/rack/lobster.rb
deleted file mode 100644
index f63f419a..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack/lobster.rb
+++ /dev/null
@@ -1,65 +0,0 @@
-require 'zlib'
-
-require 'rack/request'
-require 'rack/response'
-
-module Rack
- # Paste has a Pony, Rack has a Lobster!
- class Lobster
- LobsterString = Zlib::Inflate.inflate("eJx9kEEOwyAMBO99xd7MAcytUhPlJyj2
- P6jy9i4k9EQyGAnBarEXeCBqSkntNXsi/ZCvC48zGQoZKikGrFMZvgS5ZHd+aGWVuWwhVF0
- t1drVmiR42HcWNz5w3QanT+2gIvTVCiE1lm1Y0eU4JGmIIbaKwextKn8rvW+p5PIwFl8ZWJ
- I8jyiTlhTcYXkekJAzTyYN6E08A+dk8voBkAVTJQ==".delete("\n ").unpack("m*")[0])
-
- LambdaLobster = lambda { |env|
- if env["QUERY_STRING"].include?("flip")
- lobster = LobsterString.split("\n").
- map { |line| line.ljust(42).reverse }.
- join("\n")
- href = "?"
- else
- lobster = LobsterString
- href = "?flip"
- end
-
- content = ["Lobstericious!",
- "", lobster, "
",
- "flip!"]
- length = content.inject(0) { |a,e| a+e.size }.to_s
- [200, {"Content-Type" => "text/html", "Content-Length" => length}, content]
- }
-
- def call(env)
- req = Request.new(env)
- if req.GET["flip"] == "left"
- lobster = LobsterString.split("\n").
- map { |line| line.ljust(42).reverse }.
- join("\n")
- href = "?flip=right"
- elsif req.GET["flip"] == "crash"
- raise "Lobster crashed"
- else
- lobster = LobsterString
- href = "?flip=left"
- end
-
- res = Response.new
- res.write "Lobstericious!"
- res.write ""
- res.write lobster
- res.write "
"
- res.write "flip!
"
- res.write "crash!
"
- res.finish
- end
-
- end
-end
-
-if $0 == __FILE__
- require 'rack'
- require 'rack/showexceptions'
- Rack::Handler::WEBrick.run \
- Rack::ShowExceptions.new(Rack::Lint.new(Rack::Lobster.new)),
- :Port => 9292
-end
diff --git a/vendor/gems/rack-1.1.0/lib/rack/lock.rb b/vendor/gems/rack-1.1.0/lib/rack/lock.rb
deleted file mode 100644
index 93238528..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack/lock.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-module Rack
- class Lock
- FLAG = 'rack.multithread'.freeze
-
- def initialize(app, lock = Mutex.new)
- @app, @lock = app, lock
- end
-
- def call(env)
- old, env[FLAG] = env[FLAG], false
- @lock.synchronize { @app.call(env) }
- ensure
- env[FLAG] = old
- end
- end
-end
diff --git a/vendor/gems/rack-1.1.0/lib/rack/logger.rb b/vendor/gems/rack-1.1.0/lib/rack/logger.rb
deleted file mode 100644
index d67d8ce2..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack/logger.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-require 'logger'
-
-module Rack
- # Sets up rack.logger to write to rack.errors stream
- class Logger
- def initialize(app, level = ::Logger::INFO)
- @app, @level = app, level
- end
-
- def call(env)
- logger = ::Logger.new(env['rack.errors'])
- logger.level = @level
-
- env['rack.logger'] = logger
- @app.call(env)
- ensure
- logger.close
- end
- end
-end
diff --git a/vendor/gems/rack-1.1.0/lib/rack/methodoverride.rb b/vendor/gems/rack-1.1.0/lib/rack/methodoverride.rb
deleted file mode 100644
index 0eed29f4..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack/methodoverride.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-module Rack
- class MethodOverride
- HTTP_METHODS = %w(GET HEAD PUT POST DELETE OPTIONS)
-
- METHOD_OVERRIDE_PARAM_KEY = "_method".freeze
- HTTP_METHOD_OVERRIDE_HEADER = "HTTP_X_HTTP_METHOD_OVERRIDE".freeze
-
- def initialize(app)
- @app = app
- end
-
- def call(env)
- if env["REQUEST_METHOD"] == "POST"
- req = Request.new(env)
- method = req.POST[METHOD_OVERRIDE_PARAM_KEY] ||
- env[HTTP_METHOD_OVERRIDE_HEADER]
- method = method.to_s.upcase
- if HTTP_METHODS.include?(method)
- env["rack.methodoverride.original_method"] = env["REQUEST_METHOD"]
- env["REQUEST_METHOD"] = method
- end
- end
-
- @app.call(env)
- end
- end
-end
diff --git a/vendor/gems/rack-1.1.0/lib/rack/mime.rb b/vendor/gems/rack-1.1.0/lib/rack/mime.rb
deleted file mode 100644
index 1414d19a..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack/mime.rb
+++ /dev/null
@@ -1,206 +0,0 @@
-module Rack
- module Mime
- # Returns String with mime type if found, otherwise use +fallback+.
- # +ext+ should be filename extension in the '.ext' format that
- # File.extname(file) returns.
- # +fallback+ may be any object
- #
- # Also see the documentation for MIME_TYPES
- #
- # Usage:
- # Rack::Mime.mime_type('.foo')
- #
- # This is a shortcut for:
- # Rack::Mime::MIME_TYPES.fetch('.foo', 'application/octet-stream')
-
- def mime_type(ext, fallback='application/octet-stream')
- MIME_TYPES.fetch(ext.to_s.downcase, fallback)
- end
- module_function :mime_type
-
- # List of most common mime-types, selected various sources
- # according to their usefulness in a webserving scope for Ruby
- # users.
- #
- # To amend this list with your local mime.types list you can use:
- #
- # require 'webrick/httputils'
- # list = WEBrick::HTTPUtils.load_mime_types('/etc/mime.types')
- # Rack::Mime::MIME_TYPES.merge!(list)
- #
- # To add the list mongrel provides, use:
- #
- # require 'mongrel/handlers'
- # Rack::Mime::MIME_TYPES.merge!(Mongrel::DirHandler::MIME_TYPES)
-
- MIME_TYPES = {
- ".3gp" => "video/3gpp",
- ".a" => "application/octet-stream",
- ".ai" => "application/postscript",
- ".aif" => "audio/x-aiff",
- ".aiff" => "audio/x-aiff",
- ".asc" => "application/pgp-signature",
- ".asf" => "video/x-ms-asf",
- ".asm" => "text/x-asm",
- ".asx" => "video/x-ms-asf",
- ".atom" => "application/atom+xml",
- ".au" => "audio/basic",
- ".avi" => "video/x-msvideo",
- ".bat" => "application/x-msdownload",
- ".bin" => "application/octet-stream",
- ".bmp" => "image/bmp",
- ".bz2" => "application/x-bzip2",
- ".c" => "text/x-c",
- ".cab" => "application/vnd.ms-cab-compressed",
- ".cc" => "text/x-c",
- ".chm" => "application/vnd.ms-htmlhelp",
- ".class" => "application/octet-stream",
- ".com" => "application/x-msdownload",
- ".conf" => "text/plain",
- ".cpp" => "text/x-c",
- ".crt" => "application/x-x509-ca-cert",
- ".css" => "text/css",
- ".csv" => "text/csv",
- ".cxx" => "text/x-c",
- ".deb" => "application/x-debian-package",
- ".der" => "application/x-x509-ca-cert",
- ".diff" => "text/x-diff",
- ".djv" => "image/vnd.djvu",
- ".djvu" => "image/vnd.djvu",
- ".dll" => "application/x-msdownload",
- ".dmg" => "application/octet-stream",
- ".doc" => "application/msword",
- ".dot" => "application/msword",
- ".dtd" => "application/xml-dtd",
- ".dvi" => "application/x-dvi",
- ".ear" => "application/java-archive",
- ".eml" => "message/rfc822",
- ".eps" => "application/postscript",
- ".exe" => "application/x-msdownload",
- ".f" => "text/x-fortran",
- ".f77" => "text/x-fortran",
- ".f90" => "text/x-fortran",
- ".flv" => "video/x-flv",
- ".for" => "text/x-fortran",
- ".gem" => "application/octet-stream",
- ".gemspec" => "text/x-script.ruby",
- ".gif" => "image/gif",
- ".gz" => "application/x-gzip",
- ".h" => "text/x-c",
- ".hh" => "text/x-c",
- ".htm" => "text/html",
- ".html" => "text/html",
- ".ico" => "image/vnd.microsoft.icon",
- ".ics" => "text/calendar",
- ".ifb" => "text/calendar",
- ".iso" => "application/octet-stream",
- ".jar" => "application/java-archive",
- ".java" => "text/x-java-source",
- ".jnlp" => "application/x-java-jnlp-file",
- ".jpeg" => "image/jpeg",
- ".jpg" => "image/jpeg",
- ".js" => "application/javascript",
- ".json" => "application/json",
- ".log" => "text/plain",
- ".m3u" => "audio/x-mpegurl",
- ".m4v" => "video/mp4",
- ".man" => "text/troff",
- ".manifest"=> "text/cache-manifest",
- ".mathml" => "application/mathml+xml",
- ".mbox" => "application/mbox",
- ".mdoc" => "text/troff",
- ".me" => "text/troff",
- ".mid" => "audio/midi",
- ".midi" => "audio/midi",
- ".mime" => "message/rfc822",
- ".mml" => "application/mathml+xml",
- ".mng" => "video/x-mng",
- ".mov" => "video/quicktime",
- ".mp3" => "audio/mpeg",
- ".mp4" => "video/mp4",
- ".mp4v" => "video/mp4",
- ".mpeg" => "video/mpeg",
- ".mpg" => "video/mpeg",
- ".ms" => "text/troff",
- ".msi" => "application/x-msdownload",
- ".odp" => "application/vnd.oasis.opendocument.presentation",
- ".ods" => "application/vnd.oasis.opendocument.spreadsheet",
- ".odt" => "application/vnd.oasis.opendocument.text",
- ".ogg" => "application/ogg",
- ".ogv" => "video/ogg",
- ".p" => "text/x-pascal",
- ".pas" => "text/x-pascal",
- ".pbm" => "image/x-portable-bitmap",
- ".pdf" => "application/pdf",
- ".pem" => "application/x-x509-ca-cert",
- ".pgm" => "image/x-portable-graymap",
- ".pgp" => "application/pgp-encrypted",
- ".pkg" => "application/octet-stream",
- ".pl" => "text/x-script.perl",
- ".pm" => "text/x-script.perl-module",
- ".png" => "image/png",
- ".pnm" => "image/x-portable-anymap",
- ".ppm" => "image/x-portable-pixmap",
- ".pps" => "application/vnd.ms-powerpoint",
- ".ppt" => "application/vnd.ms-powerpoint",
- ".ps" => "application/postscript",
- ".psd" => "image/vnd.adobe.photoshop",
- ".py" => "text/x-script.python",
- ".qt" => "video/quicktime",
- ".ra" => "audio/x-pn-realaudio",
- ".rake" => "text/x-script.ruby",
- ".ram" => "audio/x-pn-realaudio",
- ".rar" => "application/x-rar-compressed",
- ".rb" => "text/x-script.ruby",
- ".rdf" => "application/rdf+xml",
- ".roff" => "text/troff",
- ".rpm" => "application/x-redhat-package-manager",
- ".rss" => "application/rss+xml",
- ".rtf" => "application/rtf",
- ".ru" => "text/x-script.ruby",
- ".s" => "text/x-asm",
- ".sgm" => "text/sgml",
- ".sgml" => "text/sgml",
- ".sh" => "application/x-sh",
- ".sig" => "application/pgp-signature",
- ".snd" => "audio/basic",
- ".so" => "application/octet-stream",
- ".svg" => "image/svg+xml",
- ".svgz" => "image/svg+xml",
- ".swf" => "application/x-shockwave-flash",
- ".t" => "text/troff",
- ".tar" => "application/x-tar",
- ".tbz" => "application/x-bzip-compressed-tar",
- ".tcl" => "application/x-tcl",
- ".tex" => "application/x-tex",
- ".texi" => "application/x-texinfo",
- ".texinfo" => "application/x-texinfo",
- ".text" => "text/plain",
- ".tif" => "image/tiff",
- ".tiff" => "image/tiff",
- ".torrent" => "application/x-bittorrent",
- ".tr" => "text/troff",
- ".txt" => "text/plain",
- ".vcf" => "text/x-vcard",
- ".vcs" => "text/x-vcalendar",
- ".vrml" => "model/vrml",
- ".war" => "application/java-archive",
- ".wav" => "audio/x-wav",
- ".wma" => "audio/x-ms-wma",
- ".wmv" => "video/x-ms-wmv",
- ".wmx" => "video/x-ms-wmx",
- ".wrl" => "model/vrml",
- ".wsdl" => "application/wsdl+xml",
- ".xbm" => "image/x-xbitmap",
- ".xhtml" => "application/xhtml+xml",
- ".xls" => "application/vnd.ms-excel",
- ".xml" => "application/xml",
- ".xpm" => "image/x-xpixmap",
- ".xsl" => "application/xml",
- ".xslt" => "application/xslt+xml",
- ".yaml" => "text/yaml",
- ".yml" => "text/yaml",
- ".zip" => "application/zip",
- }
- end
-end
diff --git a/vendor/gems/rack-1.1.0/lib/rack/mock.rb b/vendor/gems/rack-1.1.0/lib/rack/mock.rb
deleted file mode 100644
index 23ecba17..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack/mock.rb
+++ /dev/null
@@ -1,189 +0,0 @@
-require 'uri'
-require 'stringio'
-require 'rack/lint'
-require 'rack/utils'
-require 'rack/response'
-
-module Rack
- # Rack::MockRequest helps testing your Rack application without
- # actually using HTTP.
- #
- # After performing a request on a URL with get/post/put/delete, it
- # returns a MockResponse with useful helper methods for effective
- # testing.
- #
- # You can pass a hash with additional configuration to the
- # get/post/put/delete.
- # :input:: A String or IO-like to be used as rack.input.
- # :fatal:: Raise a FatalWarning if the app writes to rack.errors.
- # :lint:: If true, wrap the application in a Rack::Lint.
-
- class MockRequest
- class FatalWarning < RuntimeError
- end
-
- class FatalWarner
- def puts(warning)
- raise FatalWarning, warning
- end
-
- def write(warning)
- raise FatalWarning, warning
- end
-
- def flush
- end
-
- def string
- ""
- end
- end
-
- DEFAULT_ENV = {
- "rack.version" => [1,1],
- "rack.input" => StringIO.new,
- "rack.errors" => StringIO.new,
- "rack.multithread" => true,
- "rack.multiprocess" => true,
- "rack.run_once" => false,
- }
-
- def initialize(app)
- @app = app
- end
-
- def get(uri, opts={}) request("GET", uri, opts) end
- def post(uri, opts={}) request("POST", uri, opts) end
- def put(uri, opts={}) request("PUT", uri, opts) end
- def delete(uri, opts={}) request("DELETE", uri, opts) end
-
- def request(method="GET", uri="", opts={})
- env = self.class.env_for(uri, opts.merge(:method => method))
-
- if opts[:lint]
- app = Rack::Lint.new(@app)
- else
- app = @app
- end
-
- errors = env["rack.errors"]
- MockResponse.new(*(app.call(env) + [errors]))
- end
-
- # Return the Rack environment used for a request to +uri+.
- def self.env_for(uri="", opts={})
- uri = URI(uri)
- uri.path = "/#{uri.path}" unless uri.path[0] == ?/
-
- env = DEFAULT_ENV.dup
-
- env["REQUEST_METHOD"] = opts[:method] ? opts[:method].to_s.upcase : "GET"
- env["SERVER_NAME"] = uri.host || "example.org"
- env["SERVER_PORT"] = uri.port ? uri.port.to_s : "80"
- env["QUERY_STRING"] = uri.query.to_s
- env["PATH_INFO"] = (!uri.path || uri.path.empty?) ? "/" : uri.path
- env["rack.url_scheme"] = uri.scheme || "http"
- env["HTTPS"] = env["rack.url_scheme"] == "https" ? "on" : "off"
-
- env["SCRIPT_NAME"] = opts[:script_name] || ""
-
- if opts[:fatal]
- env["rack.errors"] = FatalWarner.new
- else
- env["rack.errors"] = StringIO.new
- end
-
- if params = opts[:params]
- if env["REQUEST_METHOD"] == "GET"
- params = Utils.parse_nested_query(params) if params.is_a?(String)
- params.update(Utils.parse_nested_query(env["QUERY_STRING"]))
- env["QUERY_STRING"] = Utils.build_nested_query(params)
- elsif !opts.has_key?(:input)
- opts["CONTENT_TYPE"] = "application/x-www-form-urlencoded"
- if params.is_a?(Hash)
- if data = Utils::Multipart.build_multipart(params)
- opts[:input] = data
- opts["CONTENT_LENGTH"] ||= data.length.to_s
- opts["CONTENT_TYPE"] = "multipart/form-data; boundary=#{Utils::Multipart::MULTIPART_BOUNDARY}"
- else
- opts[:input] = Utils.build_nested_query(params)
- end
- else
- opts[:input] = params
- end
- end
- end
-
- empty_str = ""
- empty_str.force_encoding("ASCII-8BIT") if empty_str.respond_to? :force_encoding
- opts[:input] ||= empty_str
- if String === opts[:input]
- rack_input = StringIO.new(opts[:input])
- else
- rack_input = opts[:input]
- end
-
- rack_input.set_encoding(Encoding::BINARY) if rack_input.respond_to?(:set_encoding)
- env['rack.input'] = rack_input
-
- env["CONTENT_LENGTH"] ||= env["rack.input"].length.to_s
-
- opts.each { |field, value|
- env[field] = value if String === field
- }
-
- env
- end
- end
-
- # Rack::MockResponse provides useful helpers for testing your apps.
- # Usually, you don't create the MockResponse on your own, but use
- # MockRequest.
-
- class MockResponse
- def initialize(status, headers, body, errors=StringIO.new(""))
- @status = status.to_i
-
- @original_headers = headers
- @headers = Rack::Utils::HeaderHash.new
- headers.each { |field, values|
- @headers[field] = values
- @headers[field] = "" if values.empty?
- }
-
- @body = ""
- body.each { |part| @body << part }
-
- @errors = errors.string if errors.respond_to?(:string)
- end
-
- # Status
- attr_reader :status
-
- # Headers
- attr_reader :headers, :original_headers
-
- def [](field)
- headers[field]
- end
-
-
- # Body
- attr_reader :body
-
- def =~(other)
- @body =~ other
- end
-
- def match(other)
- @body.match other
- end
-
-
- # Errors
- attr_accessor :errors
-
-
- include Response::Helpers
- end
-end
diff --git a/vendor/gems/rack-1.1.0/lib/rack/nulllogger.rb b/vendor/gems/rack-1.1.0/lib/rack/nulllogger.rb
deleted file mode 100644
index 77fb637d..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack/nulllogger.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-module Rack
- class NullLogger
- def initialize(app)
- @app = app
- end
-
- def call(env)
- env['rack.logger'] = self
- @app.call(env)
- end
-
- def info(progname = nil, &block); end
- def debug(progname = nil, &block); end
- def warn(progname = nil, &block); end
- def error(progname = nil, &block); end
- def fatal(progname = nil, &block); end
- end
-end
diff --git a/vendor/gems/rack-1.1.0/lib/rack/recursive.rb b/vendor/gems/rack-1.1.0/lib/rack/recursive.rb
deleted file mode 100644
index bf8b9659..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack/recursive.rb
+++ /dev/null
@@ -1,57 +0,0 @@
-require 'uri'
-
-module Rack
- # Rack::ForwardRequest gets caught by Rack::Recursive and redirects
- # the current request to the app at +url+.
- #
- # raise ForwardRequest.new("/not-found")
- #
-
- class ForwardRequest < Exception
- attr_reader :url, :env
-
- def initialize(url, env={})
- @url = URI(url)
- @env = env
-
- @env["PATH_INFO"] = @url.path
- @env["QUERY_STRING"] = @url.query if @url.query
- @env["HTTP_HOST"] = @url.host if @url.host
- @env["HTTP_PORT"] = @url.port if @url.port
- @env["rack.url_scheme"] = @url.scheme if @url.scheme
-
- super "forwarding to #{url}"
- end
- end
-
- # Rack::Recursive allows applications called down the chain to
- # include data from other applications (by using
- # rack['rack.recursive.include'][...] or raise a
- # ForwardRequest to redirect internally.
-
- class Recursive
- def initialize(app)
- @app = app
- end
-
- def call(env)
- @script_name = env["SCRIPT_NAME"]
- @app.call(env.merge('rack.recursive.include' => method(:include)))
- rescue ForwardRequest => req
- call(env.merge(req.env))
- end
-
- def include(env, path)
- unless path.index(@script_name) == 0 && (path[@script_name.size] == ?/ ||
- path[@script_name.size].nil?)
- raise ArgumentError, "can only include below #{@script_name}, not #{path}"
- end
-
- env = env.merge("PATH_INFO" => path, "SCRIPT_NAME" => @script_name,
- "REQUEST_METHOD" => "GET",
- "CONTENT_LENGTH" => "0", "CONTENT_TYPE" => "",
- "rack.input" => StringIO.new(""))
- @app.call(env)
- end
- end
-end
diff --git a/vendor/gems/rack-1.1.0/lib/rack/reloader.rb b/vendor/gems/rack-1.1.0/lib/rack/reloader.rb
deleted file mode 100644
index a06de23a..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack/reloader.rb
+++ /dev/null
@@ -1,109 +0,0 @@
-# Copyright (c) 2009 Michael Fellinger m.fellinger@gmail.com
-# Rack::Reloader is subject to the terms of an MIT-style license.
-# See COPYING or http://www.opensource.org/licenses/mit-license.php.
-
-require 'pathname'
-
-module Rack
-
- # High performant source reloader
- #
- # This class acts as Rack middleware.
- #
- # What makes it especially suited for use in a production environment is that
- # any file will only be checked once and there will only be made one system
- # call stat(2).
- #
- # Please note that this will not reload files in the background, it does so
- # only when actively called.
- #
- # It is performing a check/reload cycle at the start of every request, but
- # also respects a cool down time, during which nothing will be done.
- class Reloader
- def initialize(app, cooldown = 10, backend = Stat)
- @app = app
- @cooldown = cooldown
- @last = (Time.now - cooldown)
- @cache = {}
- @mtimes = {}
-
- extend backend
- end
-
- def call(env)
- if @cooldown and Time.now > @last + @cooldown
- if Thread.list.size > 1
- Thread.exclusive{ reload! }
- else
- reload!
- end
-
- @last = Time.now
- end
-
- @app.call(env)
- end
-
- def reload!(stderr = $stderr)
- rotation do |file, mtime|
- previous_mtime = @mtimes[file] ||= mtime
- safe_load(file, mtime, stderr) if mtime > previous_mtime
- end
- end
-
- # A safe Kernel::load, issuing the hooks depending on the results
- def safe_load(file, mtime, stderr = $stderr)
- load(file)
- stderr.puts "#{self.class}: reloaded `#{file}'"
- file
- rescue LoadError, SyntaxError => ex
- stderr.puts ex
- ensure
- @mtimes[file] = mtime
- end
-
- module Stat
- def rotation
- files = [$0, *$LOADED_FEATURES].uniq
- paths = ['./', *$LOAD_PATH].uniq
-
- files.map{|file|
- next if file =~ /\.(so|bundle)$/ # cannot reload compiled files
-
- found, stat = figure_path(file, paths)
- next unless found && stat && mtime = stat.mtime
-
- @cache[file] = found
-
- yield(found, mtime)
- }.compact
- end
-
- # Takes a relative or absolute +file+ name, a couple possible +paths+ that
- # the +file+ might reside in. Returns the full path and File::Stat for the
- # path.
- def figure_path(file, paths)
- found = @cache[file]
- found = file if !found and Pathname.new(file).absolute?
- found, stat = safe_stat(found)
- return found, stat if found
-
- paths.find do |possible_path|
- path = ::File.join(possible_path, file)
- found, stat = safe_stat(path)
- return ::File.expand_path(found), stat if found
- end
-
- return false, false
- end
-
- def safe_stat(file)
- return unless file
- stat = ::File.stat(file)
- return file, stat if stat.file?
- rescue Errno::ENOENT, Errno::ENOTDIR
- @cache.delete(file) and false
- end
- end
- end
-end
diff --git a/vendor/gems/rack-1.1.0/lib/rack/request.rb b/vendor/gems/rack-1.1.0/lib/rack/request.rb
deleted file mode 100644
index b3de1ce4..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack/request.rb
+++ /dev/null
@@ -1,271 +0,0 @@
-require 'rack/utils'
-
-module Rack
- # Rack::Request provides a convenient interface to a Rack
- # environment. It is stateless, the environment +env+ passed to the
- # constructor will be directly modified.
- #
- # req = Rack::Request.new(env)
- # req.post?
- # req.params["data"]
- #
- # The environment hash passed will store a reference to the Request object
- # instantiated so that it will only instantiate if an instance of the Request
- # object doesn't already exist.
-
- class Request
- # The environment of the request.
- attr_reader :env
-
- def initialize(env)
- @env = env
- end
-
- def body; @env["rack.input"] end
- def scheme; @env["rack.url_scheme"] end
- def script_name; @env["SCRIPT_NAME"].to_s end
- def path_info; @env["PATH_INFO"].to_s end
- def port; @env["SERVER_PORT"].to_i end
- def request_method; @env["REQUEST_METHOD"] end
- def query_string; @env["QUERY_STRING"].to_s end
- def content_length; @env['CONTENT_LENGTH'] end
- def content_type; @env['CONTENT_TYPE'] end
- def session; @env['rack.session'] ||= {} end
- def session_options; @env['rack.session.options'] ||= {} end
- def logger; @env['rack.logger'] end
-
- # The media type (type/subtype) portion of the CONTENT_TYPE header
- # without any media type parameters. e.g., when CONTENT_TYPE is
- # "text/plain;charset=utf-8", the media-type is "text/plain".
- #
- # For more information on the use of media types in HTTP, see:
- # http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.7
- def media_type
- content_type && content_type.split(/\s*[;,]\s*/, 2).first.downcase
- end
-
- # The media type parameters provided in CONTENT_TYPE as a Hash, or
- # an empty Hash if no CONTENT_TYPE or media-type parameters were
- # provided. e.g., when the CONTENT_TYPE is "text/plain;charset=utf-8",
- # this method responds with the following Hash:
- # { 'charset' => 'utf-8' }
- def media_type_params
- return {} if content_type.nil?
- content_type.split(/\s*[;,]\s*/)[1..-1].
- collect { |s| s.split('=', 2) }.
- inject({}) { |hash,(k,v)| hash[k.downcase] = v ; hash }
- end
-
- # The character set of the request body if a "charset" media type
- # parameter was given, or nil if no "charset" was specified. Note
- # that, per RFC2616, text/* media types that specify no explicit
- # charset are to be considered ISO-8859-1.
- def content_charset
- media_type_params['charset']
- end
-
- def host_with_port
- if forwarded = @env["HTTP_X_FORWARDED_HOST"]
- forwarded.split(/,\s?/).last
- else
- @env['HTTP_HOST'] || "#{@env['SERVER_NAME'] || @env['SERVER_ADDR']}:#{@env['SERVER_PORT']}"
- end
- end
-
- def host
- # Remove port number.
- host_with_port.to_s.gsub(/:\d+\z/, '')
- end
-
- def script_name=(s); @env["SCRIPT_NAME"] = s.to_s end
- def path_info=(s); @env["PATH_INFO"] = s.to_s end
-
- def get?; request_method == "GET" end
- def post?; request_method == "POST" end
- def put?; request_method == "PUT" end
- def delete?; request_method == "DELETE" end
- def head?; request_method == "HEAD" end
-
- # The set of form-data media-types. Requests that do not indicate
- # one of the media types presents in this list will not be eligible
- # for form-data / param parsing.
- FORM_DATA_MEDIA_TYPES = [
- 'application/x-www-form-urlencoded',
- 'multipart/form-data'
- ]
-
- # The set of media-types. Requests that do not indicate
- # one of the media types presents in this list will not be eligible
- # for param parsing like soap attachments or generic multiparts
- PARSEABLE_DATA_MEDIA_TYPES = [
- 'multipart/related',
- 'multipart/mixed'
- ]
-
- # Determine whether the request body contains form-data by checking
- # the request Content-Type for one of the media-types:
- # "application/x-www-form-urlencoded" or "multipart/form-data". The
- # list of form-data media types can be modified through the
- # +FORM_DATA_MEDIA_TYPES+ array.
- #
- # A request body is also assumed to contain form-data when no
- # Content-Type header is provided and the request_method is POST.
- def form_data?
- type = media_type
- meth = env["rack.methodoverride.original_method"] || env['REQUEST_METHOD']
- (meth == 'POST' && type.nil?) || FORM_DATA_MEDIA_TYPES.include?(type)
- end
-
- # Determine whether the request body contains data by checking
- # the request media_type against registered parse-data media-types
- def parseable_data?
- PARSEABLE_DATA_MEDIA_TYPES.include?(media_type)
- end
-
- # Returns the data recieved in the query string.
- def GET
- if @env["rack.request.query_string"] == query_string
- @env["rack.request.query_hash"]
- else
- @env["rack.request.query_string"] = query_string
- @env["rack.request.query_hash"] = parse_query(query_string)
- end
- end
-
- # Returns the data recieved in the request body.
- #
- # This method support both application/x-www-form-urlencoded and
- # multipart/form-data.
- def POST
- if @env["rack.input"].nil?
- raise "Missing rack.input"
- elsif @env["rack.request.form_input"].eql? @env["rack.input"]
- @env["rack.request.form_hash"]
- elsif form_data? || parseable_data?
- @env["rack.request.form_input"] = @env["rack.input"]
- unless @env["rack.request.form_hash"] = parse_multipart(env)
- form_vars = @env["rack.input"].read
-
- # Fix for Safari Ajax postings that always append \0
- form_vars.sub!(/\0\z/, '')
-
- @env["rack.request.form_vars"] = form_vars
- @env["rack.request.form_hash"] = parse_query(form_vars)
-
- @env["rack.input"].rewind
- end
- @env["rack.request.form_hash"]
- else
- {}
- end
- end
-
- # The union of GET and POST data.
- def params
- self.GET.update(self.POST)
- rescue EOFError => e
- self.GET
- end
-
- # shortcut for request.params[key]
- def [](key)
- params[key.to_s]
- end
-
- # shortcut for request.params[key] = value
- def []=(key, value)
- params[key.to_s] = value
- end
-
- # like Hash#values_at
- def values_at(*keys)
- keys.map{|key| params[key] }
- end
-
- # the referer of the client or '/'
- def referer
- @env['HTTP_REFERER'] || '/'
- end
- alias referrer referer
-
- def user_agent
- @env['HTTP_USER_AGENT']
- end
-
- def cookies
- return {} unless @env["HTTP_COOKIE"]
-
- if @env["rack.request.cookie_string"] == @env["HTTP_COOKIE"]
- @env["rack.request.cookie_hash"]
- else
- @env["rack.request.cookie_string"] = @env["HTTP_COOKIE"]
- # According to RFC 2109:
- # If multiple cookies satisfy the criteria above, they are ordered in
- # the Cookie header such that those with more specific Path attributes
- # precede those with less specific. Ordering with respect to other
- # attributes (e.g., Domain) is unspecified.
- @env["rack.request.cookie_hash"] =
- Utils.parse_query(@env["rack.request.cookie_string"], ';,').inject({}) {|h,(k,v)|
- h[k] = Array === v ? v.first : v
- h
- }
- end
- end
-
- def xhr?
- @env["HTTP_X_REQUESTED_WITH"] == "XMLHttpRequest"
- end
-
- # Tries to return a remake of the original request URL as a string.
- def url
- url = scheme + "://"
- url << host
-
- if scheme == "https" && port != 443 ||
- scheme == "http" && port != 80
- url << ":#{port}"
- end
-
- url << fullpath
-
- url
- end
-
- def path
- script_name + path_info
- end
-
- def fullpath
- query_string.empty? ? path : "#{path}?#{query_string}"
- end
-
- def accept_encoding
- @env["HTTP_ACCEPT_ENCODING"].to_s.split(/,\s*/).map do |part|
- m = /^([^\s,]+?)(?:;\s*q=(\d+(?:\.\d+)?))?$/.match(part) # From WEBrick
-
- if m
- [m[1], (m[2] || 1.0).to_f]
- else
- raise "Invalid value for Accept-Encoding: #{part.inspect}"
- end
- end
- end
-
- def ip
- if addr = @env['HTTP_X_FORWARDED_FOR']
- addr.split(',').last.strip
- else
- @env['REMOTE_ADDR']
- end
- end
-
- protected
- def parse_query(qs)
- Utils.parse_nested_query(qs)
- end
-
- def parse_multipart(env)
- Utils::Multipart.parse_multipart(env)
- end
- end
-end
diff --git a/vendor/gems/rack-1.1.0/lib/rack/response.rb b/vendor/gems/rack-1.1.0/lib/rack/response.rb
deleted file mode 100644
index a7f9bf2b..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack/response.rb
+++ /dev/null
@@ -1,149 +0,0 @@
-require 'rack/request'
-require 'rack/utils'
-
-module Rack
- # Rack::Response provides a convenient interface to create a Rack
- # response.
- #
- # It allows setting of headers and cookies, and provides useful
- # defaults (a OK response containing HTML).
- #
- # You can use Response#write to iteratively generate your response,
- # but note that this is buffered by Rack::Response until you call
- # +finish+. +finish+ however can take a block inside which calls to
- # +write+ are syncronous with the Rack response.
- #
- # Your application's +call+ should end returning Response#finish.
-
- class Response
- attr_accessor :length
-
- def initialize(body=[], status=200, header={}, &block)
- @status = status.to_i
- @header = Utils::HeaderHash.new({"Content-Type" => "text/html"}.
- merge(header))
-
- @writer = lambda { |x| @body << x }
- @block = nil
- @length = 0
-
- @body = []
-
- if body.respond_to? :to_str
- write body.to_str
- elsif body.respond_to?(:each)
- body.each { |part|
- write part.to_s
- }
- else
- raise TypeError, "stringable or iterable required"
- end
-
- yield self if block_given?
- end
-
- attr_reader :header
- attr_accessor :status, :body
-
- def [](key)
- header[key]
- end
-
- def []=(key, value)
- header[key] = value
- end
-
- def set_cookie(key, value)
- Utils.set_cookie_header!(header, key, value)
- end
-
- def delete_cookie(key, value={})
- Utils.delete_cookie_header!(header, key, value)
- end
-
- def redirect(target, status=302)
- self.status = status
- self["Location"] = target
- end
-
- def finish(&block)
- @block = block
-
- if [204, 304].include?(status.to_i)
- header.delete "Content-Type"
- [status.to_i, header, []]
- else
- [status.to_i, header, self]
- end
- end
- alias to_a finish # For *response
-
- def each(&callback)
- @body.each(&callback)
- @writer = callback
- @block.call(self) if @block
- end
-
- # Append to body and update Content-Length.
- #
- # NOTE: Do not mix #write and direct #body access!
- #
- def write(str)
- s = str.to_s
- @length += Rack::Utils.bytesize(s)
- @writer.call s
-
- header["Content-Length"] = @length.to_s
- str
- end
-
- def close
- body.close if body.respond_to?(:close)
- end
-
- def empty?
- @block == nil && @body.empty?
- end
-
- alias headers header
-
- module Helpers
- def invalid?; @status < 100 || @status >= 600; end
-
- def informational?; @status >= 100 && @status < 200; end
- def successful?; @status >= 200 && @status < 300; end
- def redirection?; @status >= 300 && @status < 400; end
- def client_error?; @status >= 400 && @status < 500; end
- def server_error?; @status >= 500 && @status < 600; end
-
- def ok?; @status == 200; end
- def forbidden?; @status == 403; end
- def not_found?; @status == 404; end
-
- def redirect?; [301, 302, 303, 307].include? @status; end
- def empty?; [201, 204, 304].include? @status; end
-
- # Headers
- attr_reader :headers, :original_headers
-
- def include?(header)
- !!headers[header]
- end
-
- def content_type
- headers["Content-Type"]
- end
-
- def content_length
- cl = headers["Content-Length"]
- cl ? cl.to_i : cl
- end
-
- def location
- headers["Location"]
- end
- end
-
- include Helpers
- end
-end
diff --git a/vendor/gems/rack-1.1.0/lib/rack/rewindable_input.rb b/vendor/gems/rack-1.1.0/lib/rack/rewindable_input.rb
deleted file mode 100644
index accd96be..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack/rewindable_input.rb
+++ /dev/null
@@ -1,100 +0,0 @@
-require 'tempfile'
-
-module Rack
- # Class which can make any IO object rewindable, including non-rewindable ones. It does
- # this by buffering the data into a tempfile, which is rewindable.
- #
- # rack.input is required to be rewindable, so if your input stream IO is non-rewindable
- # by nature (e.g. a pipe or a socket) then you can wrap it in an object of this class
- # to easily make it rewindable.
- #
- # Don't forget to call #close when you're done. This frees up temporary resources that
- # RewindableInput uses, though it does *not* close the original IO object.
- class RewindableInput
- def initialize(io)
- @io = io
- @rewindable_io = nil
- @unlinked = false
- end
-
- def gets
- make_rewindable unless @rewindable_io
- @rewindable_io.gets
- end
-
- def read(*args)
- make_rewindable unless @rewindable_io
- @rewindable_io.read(*args)
- end
-
- def each(&block)
- make_rewindable unless @rewindable_io
- @rewindable_io.each(&block)
- end
-
- def rewind
- make_rewindable unless @rewindable_io
- @rewindable_io.rewind
- end
-
- # Closes this RewindableInput object without closing the originally
- # wrapped IO oject. Cleans up any temporary resources that this RewindableInput
- # has created.
- #
- # This method may be called multiple times. It does nothing on subsequent calls.
- def close
- if @rewindable_io
- if @unlinked
- @rewindable_io.close
- else
- @rewindable_io.close!
- end
- @rewindable_io = nil
- end
- end
-
- private
-
- # Ruby's Tempfile class has a bug. Subclass it and fix it.
- class Tempfile < ::Tempfile
- def _close
- @tmpfile.close if @tmpfile
- @data[1] = nil if @data
- @tmpfile = nil
- end
- end
-
- def make_rewindable
- # Buffer all data into a tempfile. Since this tempfile is private to this
- # RewindableInput object, we chmod it so that nobody else can read or write
- # it. On POSIX filesystems we also unlink the file so that it doesn't
- # even have a file entry on the filesystem anymore, though we can still
- # access it because we have the file handle open.
- @rewindable_io = Tempfile.new('RackRewindableInput')
- @rewindable_io.chmod(0000)
- @rewindable_io.set_encoding(Encoding::BINARY) if @rewindable_io.respond_to?(:set_encoding)
- @rewindable_io.binmode
- if filesystem_has_posix_semantics?
- @rewindable_io.unlink
- @unlinked = true
- end
-
- buffer = ""
- while @io.read(1024 * 4, buffer)
- entire_buffer_written_out = false
- while !entire_buffer_written_out
- written = @rewindable_io.write(buffer)
- entire_buffer_written_out = written == buffer.size
- if !entire_buffer_written_out
- buffer.slice!(0 .. written - 1)
- end
- end
- end
- @rewindable_io.rewind
- end
-
- def filesystem_has_posix_semantics?
- RUBY_PLATFORM !~ /(mswin|mingw|cygwin|java)/
- end
- end
-end
diff --git a/vendor/gems/rack-1.1.0/lib/rack/runtime.rb b/vendor/gems/rack-1.1.0/lib/rack/runtime.rb
deleted file mode 100644
index 1bd411fd..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack/runtime.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-module Rack
- # Sets an "X-Runtime" response header, indicating the response
- # time of the request, in seconds
- #
- # You can put it right before the application to see the processing
- # time, or before all the other middlewares to include time for them,
- # too.
- class Runtime
- def initialize(app, name = nil)
- @app = app
- @header_name = "X-Runtime"
- @header_name << "-#{name}" if name
- end
-
- def call(env)
- start_time = Time.now
- status, headers, body = @app.call(env)
- request_time = Time.now - start_time
-
- if !headers.has_key?(@header_name)
- headers[@header_name] = "%0.6f" % request_time
- end
-
- [status, headers, body]
- end
- end
-end
diff --git a/vendor/gems/rack-1.1.0/lib/rack/sendfile.rb b/vendor/gems/rack-1.1.0/lib/rack/sendfile.rb
deleted file mode 100644
index 4fa82946..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack/sendfile.rb
+++ /dev/null
@@ -1,142 +0,0 @@
-require 'rack/file'
-
-module Rack
- class File #:nodoc:
- alias :to_path :path
- end
-
- # = Sendfile
- #
- # The Sendfile middleware intercepts responses whose body is being
- # served from a file and replaces it with a server specific X-Sendfile
- # header. The web server is then responsible for writing the file contents
- # to the client. This can dramatically reduce the amount of work required
- # by the Ruby backend and takes advantage of the web servers optimized file
- # delivery code.
- #
- # In order to take advantage of this middleware, the response body must
- # respond to +to_path+ and the request must include an X-Sendfile-Type
- # header. Rack::File and other components implement +to_path+ so there's
- # rarely anything you need to do in your application. The X-Sendfile-Type
- # header is typically set in your web servers configuration. The following
- # sections attempt to document
- #
- # === Nginx
- #
- # Nginx supports the X-Accel-Redirect header. This is similar to X-Sendfile
- # but requires parts of the filesystem to be mapped into a private URL
- # hierarachy.
- #
- # The following example shows the Nginx configuration required to create
- # a private "/files/" area, enable X-Accel-Redirect, and pass the special
- # X-Sendfile-Type and X-Accel-Mapping headers to the backend:
- #
- # location /files/ {
- # internal;
- # alias /var/www/;
- # }
- #
- # location / {
- # proxy_redirect false;
- #
- # proxy_set_header Host $host;
- # proxy_set_header X-Real-IP $remote_addr;
- # proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- #
- # proxy_set_header X-Sendfile-Type X-Accel-Redirect
- # proxy_set_header X-Accel-Mapping /files/=/var/www/;
- #
- # proxy_pass http://127.0.0.1:8080/;
- # }
- #
- # Note that the X-Sendfile-Type header must be set exactly as shown above. The
- # X-Accel-Mapping header should specify the name of the private URL pattern,
- # followed by an equals sign (=), followed by the location on the file system
- # that it maps to. The middleware performs a simple substitution on the
- # resulting path.
- #
- # See Also: http://wiki.codemongers.com/NginxXSendfile
- #
- # === lighttpd
- #
- # Lighttpd has supported some variation of the X-Sendfile header for some
- # time, although only recent version support X-Sendfile in a reverse proxy
- # configuration.
- #
- # $HTTP["host"] == "example.com" {
- # proxy-core.protocol = "http"
- # proxy-core.balancer = "round-robin"
- # proxy-core.backends = (
- # "127.0.0.1:8000",
- # "127.0.0.1:8001",
- # ...
- # )
- #
- # proxy-core.allow-x-sendfile = "enable"
- # proxy-core.rewrite-request = (
- # "X-Sendfile-Type" => (".*" => "X-Sendfile")
- # )
- # }
- #
- # See Also: http://redmine.lighttpd.net/wiki/lighttpd/Docs:ModProxyCore
- #
- # === Apache
- #
- # X-Sendfile is supported under Apache 2.x using a separate module:
- #
- # http://tn123.ath.cx/mod_xsendfile/
- #
- # Once the module is compiled and installed, you can enable it using
- # XSendFile config directive:
- #
- # RequestHeader Set X-Sendfile-Type X-Sendfile
- # ProxyPassReverse / http://localhost:8001/
- # XSendFile on
-
- class Sendfile
- F = ::File
-
- def initialize(app, variation=nil)
- @app = app
- @variation = variation
- end
-
- def call(env)
- status, headers, body = @app.call(env)
- if body.respond_to?(:to_path)
- case type = variation(env)
- when 'X-Accel-Redirect'
- path = F.expand_path(body.to_path)
- if url = map_accel_path(env, path)
- headers[type] = url
- body = []
- else
- env['rack.errors'] << "X-Accel-Mapping header missing"
- end
- when 'X-Sendfile', 'X-Lighttpd-Send-File'
- path = F.expand_path(body.to_path)
- headers[type] = path
- body = []
- when '', nil
- else
- env['rack.errors'] << "Unknown x-sendfile variation: '#{variation}'.\n"
- end
- end
- [status, headers, body]
- end
-
- private
- def variation(env)
- @variation ||
- env['sendfile.type'] ||
- env['HTTP_X_SENDFILE_TYPE']
- end
-
- def map_accel_path(env, file)
- if mapping = env['HTTP_X_ACCEL_MAPPING']
- internal, external = mapping.split('=', 2).map{ |p| p.strip }
- file.sub(/^#{internal}/i, external)
- end
- end
- end
-end
diff --git a/vendor/gems/rack-1.1.0/lib/rack/server.rb b/vendor/gems/rack-1.1.0/lib/rack/server.rb
deleted file mode 100644
index 2bb20aae..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack/server.rb
+++ /dev/null
@@ -1,212 +0,0 @@
-require 'optparse'
-
-module Rack
- class Server
- class Options
- def parse!(args)
- options = {}
- opt_parser = OptionParser.new("", 24, ' ') do |opts|
- opts.banner = "Usage: rackup [ruby options] [rack options] [rackup config]"
-
- opts.separator ""
- opts.separator "Ruby options:"
-
- lineno = 1
- opts.on("-e", "--eval LINE", "evaluate a LINE of code") { |line|
- eval line, TOPLEVEL_BINDING, "-e", lineno
- lineno += 1
- }
-
- opts.on("-d", "--debug", "set debugging flags (set $DEBUG to true)") {
- options[:debug] = true
- }
- opts.on("-w", "--warn", "turn warnings on for your script") {
- options[:warn] = true
- }
-
- opts.on("-I", "--include PATH",
- "specify $LOAD_PATH (may be used more than once)") { |path|
- options[:include] = path.split(":")
- }
-
- opts.on("-r", "--require LIBRARY",
- "require the library, before executing your script") { |library|
- options[:require] = library
- }
-
- opts.separator ""
- opts.separator "Rack options:"
- opts.on("-s", "--server SERVER", "serve using SERVER (webrick/mongrel)") { |s|
- options[:server] = s
- }
-
- opts.on("-o", "--host HOST", "listen on HOST (default: 0.0.0.0)") { |host|
- options[:Host] = host
- }
-
- opts.on("-p", "--port PORT", "use PORT (default: 9292)") { |port|
- options[:Port] = port
- }
-
- opts.on("-E", "--env ENVIRONMENT", "use ENVIRONMENT for defaults (default: development)") { |e|
- options[:environment] = e
- }
-
- opts.on("-D", "--daemonize", "run daemonized in the background") { |d|
- options[:daemonize] = d ? true : false
- }
-
- opts.on("-P", "--pid FILE", "file to store PID (default: rack.pid)") { |f|
- options[:pid] = f
- }
-
- opts.separator ""
- opts.separator "Common options:"
-
- opts.on_tail("-h", "--help", "Show this message") do
- puts opts
- exit
- end
-
- opts.on_tail("--version", "Show version") do
- puts "Rack #{Rack.version}"
- exit
- end
- end
- opt_parser.parse! args
- options[:config] = args.last if args.last
- options
- end
- end
-
- def self.start
- new.start
- end
-
- attr_accessor :options
-
- def initialize(options = nil)
- @options = options
- end
-
- def options
- @options ||= parse_options(ARGV)
- end
-
- def default_options
- {
- :environment => "development",
- :pid => nil,
- :Port => 9292,
- :Host => "0.0.0.0",
- :AccessLog => [],
- :config => "config.ru"
- }
- end
-
- def app
- @app ||= begin
- if !::File.exist? options[:config]
- abort "configuration #{options[:config]} not found"
- end
-
- app, options = Rack::Builder.parse_file(self.options[:config], opt_parser)
- self.options.merge! options
- app
- end
- end
-
- def self.middleware
- @middleware ||= begin
- m = Hash.new {|h,k| h[k] = []}
- m["deployment"].concat [lambda {|server| server.server =~ /CGI/ ? nil : [Rack::CommonLogger, $stderr] }]
- m["development"].concat m["deployment"] + [[Rack::ShowExceptions], [Rack::Lint]]
- m
- end
- end
-
- def middleware
- self.class.middleware
- end
-
- def start
- if options[:debug]
- $DEBUG = true
- require 'pp'
- p options[:server]
- pp wrapped_app
- pp app
- end
-
- if options[:warn]
- $-w = true
- end
-
- if includes = options[:include]
- $LOAD_PATH.unshift *includes
- end
-
- if library = options[:require]
- require library
- end
-
- daemonize_app if options[:daemonize]
- write_pid if options[:pid]
- server.run wrapped_app, options
- end
-
- def server
- @_server ||= Rack::Handler.get(options[:server]) || Rack::Handler.default
- end
-
- private
- def parse_options(args)
- options = default_options
-
- # Don't evaluate CGI ISINDEX parameters.
- # http://hoohoo.ncsa.uiuc.edu/cgi/cl.html
- args.clear if ENV.include?("REQUEST_METHOD")
-
- options.merge! opt_parser.parse! args
- options
- end
-
- def opt_parser
- Options.new
- end
-
- def build_app(app)
- middleware[options[:environment]].reverse_each do |middleware|
- middleware = middleware.call(self) if middleware.respond_to?(:call)
- next unless middleware
- klass = middleware.shift
- app = klass.new(app, *middleware)
- end
- app
- end
-
- def wrapped_app
- @wrapped_app ||= build_app app
- end
-
- def daemonize_app
- if RUBY_VERSION < "1.9"
- exit if fork
- Process.setsid
- exit if fork
- Dir.chdir "/"
- ::File.umask 0000
- STDIN.reopen "/dev/null"
- STDOUT.reopen "/dev/null", "a"
- STDERR.reopen "/dev/null", "a"
- else
- Process.daemon
- end
- end
-
- def write_pid
- ::File.open(options[:pid], 'w'){ |f| f.write("#{Process.pid}") }
- at_exit { ::File.delete(options[:pid]) if ::File.exist?(options[:pid]) }
- end
- end
-end
diff --git a/vendor/gems/rack-1.1.0/lib/rack/session/abstract/id.rb b/vendor/gems/rack-1.1.0/lib/rack/session/abstract/id.rb
deleted file mode 100644
index 98746705..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack/session/abstract/id.rb
+++ /dev/null
@@ -1,140 +0,0 @@
-# AUTHOR: blink ; blink#ruby-lang@irc.freenode.net
-# bugrep: Andreas Zehnder
-
-require 'time'
-require 'rack/request'
-require 'rack/response'
-
-module Rack
-
- module Session
-
- module Abstract
-
- # ID sets up a basic framework for implementing an id based sessioning
- # service. Cookies sent to the client for maintaining sessions will only
- # contain an id reference. Only #get_session and #set_session are
- # required to be overwritten.
- #
- # All parameters are optional.
- # * :key determines the name of the cookie, by default it is
- # 'rack.session'
- # * :path, :domain, :expire_after, :secure, and :httponly set the related
- # cookie options as by Rack::Response#add_cookie
- # * :defer will not set a cookie in the response.
- # * :renew (implementation dependent) will prompt the generation of a new
- # session id, and migration of data to be referenced at the new id. If
- # :defer is set, it will be overridden and the cookie will be set.
- # * :sidbits sets the number of bits in length that a generated session
- # id will be.
- #
- # These options can be set on a per request basis, at the location of
- # env['rack.session.options']. Additionally the id of the session can be
- # found within the options hash at the key :id. It is highly not
- # recommended to change its value.
- #
- # Is Rack::Utils::Context compatible.
-
- class ID
- DEFAULT_OPTIONS = {
- :path => '/',
- :domain => nil,
- :expire_after => nil,
- :secure => false,
- :httponly => true,
- :defer => false,
- :renew => false,
- :sidbits => 128
- }
-
- attr_reader :key, :default_options
- def initialize(app, options={})
- @app = app
- @key = options[:key] || "rack.session"
- @default_options = self.class::DEFAULT_OPTIONS.merge(options)
- end
-
- def call(env)
- context(env)
- end
-
- def context(env, app=@app)
- load_session(env)
- status, headers, body = app.call(env)
- commit_session(env, status, headers, body)
- end
-
- private
-
- # Generate a new session id using Ruby #rand. The size of the
- # session id is controlled by the :sidbits option.
- # Monkey patch this to use custom methods for session id generation.
-
- def generate_sid
- "%0#{@default_options[:sidbits] / 4}x" %
- rand(2**@default_options[:sidbits] - 1)
- end
-
- # Extracts the session id from provided cookies and passes it and the
- # environment to #get_session. It then sets the resulting session into
- # 'rack.session', and places options and session metadata into
- # 'rack.session.options'.
-
- def load_session(env)
- request = Rack::Request.new(env)
- session_id = request.cookies[@key]
-
- begin
- session_id, session = get_session(env, session_id)
- env['rack.session'] = session
- rescue
- env['rack.session'] = Hash.new
- end
-
- env['rack.session.options'] = @default_options.
- merge(:id => session_id)
- end
-
- # Acquires the session from the environment and the session id from
- # the session options and passes them to #set_session. If successful
- # and the :defer option is not true, a cookie will be added to the
- # response with the session's id.
-
- def commit_session(env, status, headers, body)
- session = env['rack.session']
- options = env['rack.session.options']
- session_id = options[:id]
-
- if not session_id = set_session(env, session_id, session, options)
- env["rack.errors"].puts("Warning! #{self.class.name} failed to save session. Content dropped.")
- elsif options[:defer] and not options[:renew]
- env["rack.errors"].puts("Defering cookie for #{session_id}") if $VERBOSE
- else
- cookie = Hash.new
- cookie[:value] = session_id
- cookie[:expires] = Time.now + options[:expire_after] unless options[:expire_after].nil?
- Utils.set_cookie_header!(headers, @key, cookie.merge(options))
- end
-
- [status, headers, body]
- end
-
- # All thread safety and session retrival proceedures should occur here.
- # Should return [session_id, session].
- # If nil is provided as the session id, generation of a new valid id
- # should occur within.
-
- def get_session(env, sid)
- raise '#get_session not implemented.'
- end
-
- # All thread safety and session storage proceedures should occur here.
- # Should return true or false dependant on whether or not the session
- # was saved or not.
- def set_session(env, sid, session, options)
- raise '#set_session not implemented.'
- end
- end
- end
- end
-end
diff --git a/vendor/gems/rack-1.1.0/lib/rack/session/cookie.rb b/vendor/gems/rack-1.1.0/lib/rack/session/cookie.rb
deleted file mode 100644
index 240e6c8d..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack/session/cookie.rb
+++ /dev/null
@@ -1,90 +0,0 @@
-require 'openssl'
-require 'rack/request'
-require 'rack/response'
-
-module Rack
-
- module Session
-
- # Rack::Session::Cookie provides simple cookie based session management.
- # The session is a Ruby Hash stored as base64 encoded marshalled data
- # set to :key (default: rack.session).
- # When the secret key is set, cookie data is checked for data integrity.
- #
- # Example:
- #
- # use Rack::Session::Cookie, :key => 'rack.session',
- # :domain => 'foo.com',
- # :path => '/',
- # :expire_after => 2592000,
- # :secret => 'change_me'
- #
- # All parameters are optional.
-
- class Cookie
-
- def initialize(app, options={})
- @app = app
- @key = options[:key] || "rack.session"
- @secret = options[:secret]
- @default_options = {:domain => nil,
- :path => "/",
- :expire_after => nil}.merge(options)
- end
-
- def call(env)
- load_session(env)
- status, headers, body = @app.call(env)
- commit_session(env, status, headers, body)
- end
-
- private
-
- def load_session(env)
- request = Rack::Request.new(env)
- session_data = request.cookies[@key]
-
- if @secret && session_data
- session_data, digest = session_data.split("--")
- session_data = nil unless digest == generate_hmac(session_data)
- end
-
- begin
- session_data = session_data.unpack("m*").first
- session_data = Marshal.load(session_data)
- env["rack.session"] = session_data
- rescue
- env["rack.session"] = Hash.new
- end
-
- env["rack.session.options"] = @default_options.dup
- end
-
- def commit_session(env, status, headers, body)
- session_data = Marshal.dump(env["rack.session"])
- session_data = [session_data].pack("m*")
-
- if @secret
- session_data = "#{session_data}--#{generate_hmac(session_data)}"
- end
-
- if session_data.size > (4096 - @key.size)
- env["rack.errors"].puts("Warning! Rack::Session::Cookie data size exceeds 4K. Content dropped.")
- else
- options = env["rack.session.options"]
- cookie = Hash.new
- cookie[:value] = session_data
- cookie[:expires] = Time.now + options[:expire_after] unless options[:expire_after].nil?
- Utils.set_cookie_header!(headers, @key, cookie.merge(options))
- end
-
- [status, headers, body]
- end
-
- def generate_hmac(data)
- OpenSSL::HMAC.hexdigest(OpenSSL::Digest::SHA1.new, @secret, data)
- end
-
- end
- end
-end
diff --git a/vendor/gems/rack-1.1.0/lib/rack/session/memcache.rb b/vendor/gems/rack-1.1.0/lib/rack/session/memcache.rb
deleted file mode 100644
index 44629da3..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack/session/memcache.rb
+++ /dev/null
@@ -1,119 +0,0 @@
-# AUTHOR: blink ; blink#ruby-lang@irc.freenode.net
-
-require 'rack/session/abstract/id'
-require 'memcache'
-
-module Rack
- module Session
- # Rack::Session::Memcache provides simple cookie based session management.
- # Session data is stored in memcached. The corresponding session key is
- # maintained in the cookie.
- # You may treat Session::Memcache as you would Session::Pool with the
- # following caveats.
- #
- # * Setting :expire_after to 0 would note to the Memcache server to hang
- # onto the session data until it would drop it according to it's own
- # specifications. However, the cookie sent to the client would expire
- # immediately.
- #
- # Note that memcache does drop data before it may be listed to expire. For
- # a full description of behaviour, please see memcache's documentation.
-
- class Memcache < Abstract::ID
- attr_reader :mutex, :pool
- DEFAULT_OPTIONS = Abstract::ID::DEFAULT_OPTIONS.merge \
- :namespace => 'rack:session',
- :memcache_server => 'localhost:11211'
-
- def initialize(app, options={})
- super
-
- @mutex = Mutex.new
- mserv = @default_options[:memcache_server]
- mopts = @default_options.
- reject{|k,v| MemCache::DEFAULT_OPTIONS.include? k }
- @pool = MemCache.new mserv, mopts
- unless @pool.active? and @pool.servers.any?{|c| c.alive? }
- raise 'No memcache servers'
- end
- end
-
- def generate_sid
- loop do
- sid = super
- break sid unless @pool.get(sid, true)
- end
- end
-
- def get_session(env, session_id)
- @mutex.lock if env['rack.multithread']
- unless session_id and session = @pool.get(session_id)
- session_id, session = generate_sid, {}
- unless /^STORED/ =~ @pool.add(session_id, session)
- raise "Session collision on '#{session_id.inspect}'"
- end
- end
- session.instance_variable_set '@old', @pool.get(session_id, true)
- return [session_id, session]
- rescue MemCache::MemCacheError, Errno::ECONNREFUSED
- # MemCache server cannot be contacted
- warn "#{self} is unable to find memcached server."
- warn $!.inspect
- return [ nil, {} ]
- ensure
- @mutex.unlock if @mutex.locked?
- end
-
- def set_session(env, session_id, new_session, options)
- expiry = options[:expire_after]
- expiry = expiry.nil? ? 0 : expiry + 1
-
- @mutex.lock if env['rack.multithread']
- if options[:renew] or options[:drop]
- @pool.delete session_id
- return false if options[:drop]
- session_id = generate_sid
- @pool.add session_id, {} # so we don't worry about cache miss on #set
- end
-
- session = @pool.get(session_id) || {}
- old_session = new_session.instance_variable_get '@old'
- old_session = old_session ? Marshal.load(old_session) : {}
-
- unless Hash === old_session and Hash === new_session
- env['rack.errors'].
- puts 'Bad old_session or new_session sessions provided.'
- else # merge sessions
- # alterations are either update or delete, making as few changes as
- # possible to prevent possible issues.
-
- # removed keys
- delete = old_session.keys - new_session.keys
- if $VERBOSE and not delete.empty?
- env['rack.errors'].
- puts "//@#{session_id}: delete #{delete*','}"
- end
- delete.each{|k| session.delete k }
-
- # added or altered keys
- update = new_session.keys.
- select{|k| new_session[k] != old_session[k] }
- if $VERBOSE and not update.empty?
- env['rack.errors'].puts "//@#{session_id}: update #{update*','}"
- end
- update.each{|k| session[k] = new_session[k] }
- end
-
- @pool.set session_id, session, expiry
- return session_id
- rescue MemCache::MemCacheError, Errno::ECONNREFUSED
- # MemCache server cannot be contacted
- warn "#{self} is unable to find memcached server."
- warn $!.inspect
- return false
- ensure
- @mutex.unlock if @mutex.locked?
- end
- end
- end
-end
diff --git a/vendor/gems/rack-1.1.0/lib/rack/session/pool.rb b/vendor/gems/rack-1.1.0/lib/rack/session/pool.rb
deleted file mode 100644
index b3f8bd72..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack/session/pool.rb
+++ /dev/null
@@ -1,100 +0,0 @@
-# AUTHOR: blink ; blink#ruby-lang@irc.freenode.net
-# THANKS:
-# apeiros, for session id generation, expiry setup, and threadiness
-# sergio, threadiness and bugreps
-
-require 'rack/session/abstract/id'
-require 'thread'
-
-module Rack
- module Session
- # Rack::Session::Pool provides simple cookie based session management.
- # Session data is stored in a hash held by @pool.
- # In the context of a multithreaded environment, sessions being
- # committed to the pool is done in a merging manner.
- #
- # The :drop option is available in rack.session.options if you wish to
- # explicitly remove the session from the session cache.
- #
- # Example:
- # myapp = MyRackApp.new
- # sessioned = Rack::Session::Pool.new(myapp,
- # :domain => 'foo.com',
- # :expire_after => 2592000
- # )
- # Rack::Handler::WEBrick.run sessioned
-
- class Pool < Abstract::ID
- attr_reader :mutex, :pool
- DEFAULT_OPTIONS = Abstract::ID::DEFAULT_OPTIONS.merge :drop => false
-
- def initialize(app, options={})
- super
- @pool = Hash.new
- @mutex = Mutex.new
- end
-
- def generate_sid
- loop do
- sid = super
- break sid unless @pool.key? sid
- end
- end
-
- def get_session(env, sid)
- session = @pool[sid] if sid
- @mutex.lock if env['rack.multithread']
- unless sid and session
- env['rack.errors'].puts("Session '#{sid.inspect}' not found, initializing...") if $VERBOSE and not sid.nil?
- session = {}
- sid = generate_sid
- @pool.store sid, session
- end
- session.instance_variable_set('@old', {}.merge(session))
- return [sid, session]
- ensure
- @mutex.unlock if env['rack.multithread']
- end
-
- def set_session(env, session_id, new_session, options)
- @mutex.lock if env['rack.multithread']
- session = @pool[session_id]
- if options[:renew] or options[:drop]
- @pool.delete session_id
- return false if options[:drop]
- session_id = generate_sid
- @pool.store session_id, 0
- end
- old_session = new_session.instance_variable_get('@old') || {}
- session = merge_sessions session_id, old_session, new_session, session
- @pool.store session_id, session
- return session_id
- rescue
- warn "#{new_session.inspect} has been lost."
- warn $!.inspect
- ensure
- @mutex.unlock if env['rack.multithread']
- end
-
- private
-
- def merge_sessions sid, old, new, cur=nil
- cur ||= {}
- unless Hash === old and Hash === new
- warn 'Bad old or new sessions provided.'
- return cur
- end
-
- delete = old.keys - new.keys
- warn "//@#{sid}: dropping #{delete*','}" if $DEBUG and not delete.empty?
- delete.each{|k| cur.delete k }
-
- update = new.keys.select{|k| new[k] != old[k] }
- warn "//@#{sid}: updating #{update*','}" if $DEBUG and not update.empty?
- update.each{|k| cur[k] = new[k] }
-
- cur
- end
- end
- end
-end
diff --git a/vendor/gems/rack-1.1.0/lib/rack/showexceptions.rb b/vendor/gems/rack-1.1.0/lib/rack/showexceptions.rb
deleted file mode 100644
index 697bc41f..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack/showexceptions.rb
+++ /dev/null
@@ -1,349 +0,0 @@
-require 'ostruct'
-require 'erb'
-require 'rack/request'
-require 'rack/utils'
-
-module Rack
- # Rack::ShowExceptions catches all exceptions raised from the app it
- # wraps. It shows a useful backtrace with the sourcefile and
- # clickable context, the whole Rack environment and the request
- # data.
- #
- # Be careful when you use this on public-facing sites as it could
- # reveal information helpful to attackers.
-
- class ShowExceptions
- CONTEXT = 7
-
- def initialize(app)
- @app = app
- @template = ERB.new(TEMPLATE)
- end
-
- def call(env)
- @app.call(env)
- rescue StandardError, LoadError, SyntaxError => e
- backtrace = pretty(env, e)
- [500,
- {"Content-Type" => "text/html",
- "Content-Length" => backtrace.join.size.to_s},
- backtrace]
- end
-
- def pretty(env, exception)
- req = Rack::Request.new(env)
- path = (req.script_name + req.path_info).squeeze("/")
-
- frames = exception.backtrace.map { |line|
- frame = OpenStruct.new
- if line =~ /(.*?):(\d+)(:in `(.*)')?/
- frame.filename = $1
- frame.lineno = $2.to_i
- frame.function = $4
-
- begin
- lineno = frame.lineno-1
- lines = ::File.readlines(frame.filename)
- frame.pre_context_lineno = [lineno-CONTEXT, 0].max
- frame.pre_context = lines[frame.pre_context_lineno...lineno]
- frame.context_line = lines[lineno].chomp
- frame.post_context_lineno = [lineno+CONTEXT, lines.size].min
- frame.post_context = lines[lineno+1..frame.post_context_lineno]
- rescue
- end
-
- frame
- else
- nil
- end
- }.compact
-
- env["rack.errors"].puts "#{exception.class}: #{exception.message}"
- env["rack.errors"].puts exception.backtrace.map { |l| "\t" + l }
- env["rack.errors"].flush
-
- [@template.result(binding)]
- end
-
- def h(obj) # :nodoc:
- case obj
- when String
- Utils.escape_html(obj)
- else
- Utils.escape_html(obj.inspect)
- end
- end
-
- # :stopdoc:
-
-# adapted from Django
-# Copyright (c) 2005, the Lawrence Journal-World
-# Used under the modified BSD license:
-# http://www.xfree86.org/3.3.6/COPYRIGHT2.html#5
-TEMPLATE = <<'HTML'
-
-
-
-
-
- <%=h exception.class %> at <%=h path %>
-
-
-
-
-
-
-
<%=h exception.class %> at <%=h path %>
-
<%=h exception.message %>
-
- | Ruby |
- <%=h frames.first.filename %>: in <%=h frames.first.function %>, line <%=h frames.first.lineno %> |
-
- | Web |
- <%=h req.request_method %> <%=h(req.host + path)%> |
-
-
-
Jump to:
-
-
-
-
-
Traceback (innermost first)
-
-<% frames.each { |frame| %>
- -
-
<%=h frame.filename %>: in <%=h frame.function %>
-
- <% if frame.context_line %>
-
- <% if frame.pre_context %>
-
- <% frame.pre_context.each { |line| %>
- - <%=h line %>
- <% } %>
-
- <% end %>
-
-
- - <%=h frame.context_line %>...
-
- <% if frame.post_context %>
-
- <% frame.post_context.each { |line| %>
- - <%=h line %>
- <% } %>
-
- <% end %>
-
- <% end %>
-
-<% } %>
-
-
-
-
-
Request information
-
-
GET
- <% unless req.GET.empty? %>
-
-
-
- | Variable |
- Value |
-
-
-
- <% req.GET.sort_by { |k, v| k.to_s }.each { |key, val| %>
-
- | <%=h key %> |
- <%=h val.inspect %> |
-
- <% } %>
-
-
- <% else %>
-
No GET data.
- <% end %>
-
-
POST
- <% unless req.POST.empty? %>
-
-
-
- | Variable |
- Value |
-
-
-
- <% req.POST.sort_by { |k, v| k.to_s }.each { |key, val| %>
-
- | <%=h key %> |
- <%=h val.inspect %> |
-
- <% } %>
-
-
- <% else %>
-
No POST data.
- <% end %>
-
-
-
COOKIES
- <% unless req.cookies.empty? %>
-
-
-
- | Variable |
- Value |
-
-
-
- <% req.cookies.each { |key, val| %>
-
- | <%=h key %> |
- <%=h val.inspect %> |
-
- <% } %>
-
-
- <% else %>
-
No cookie data.
- <% end %>
-
-
Rack ENV
-
-
-
- | Variable |
- Value |
-
-
-
- <% env.sort_by { |k, v| k.to_s }.each { |key, val| %>
-
- | <%=h key %> |
- <%=h val %> |
-
- <% } %>
-
-
-
-
-
-
-
- You're seeing this error because you use Rack::ShowExceptions.
-
-
-
-
-
-HTML
-
- # :startdoc:
- end
-end
diff --git a/vendor/gems/rack-1.1.0/lib/rack/showstatus.rb b/vendor/gems/rack-1.1.0/lib/rack/showstatus.rb
deleted file mode 100644
index 28258c7c..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack/showstatus.rb
+++ /dev/null
@@ -1,106 +0,0 @@
-require 'erb'
-require 'rack/request'
-require 'rack/utils'
-
-module Rack
- # Rack::ShowStatus catches all empty responses the app it wraps and
- # replaces them with a site explaining the error.
- #
- # Additional details can be put into rack.showstatus.detail
- # and will be shown as HTML. If such details exist, the error page
- # is always rendered, even if the reply was not empty.
-
- class ShowStatus
- def initialize(app)
- @app = app
- @template = ERB.new(TEMPLATE)
- end
-
- def call(env)
- status, headers, body = @app.call(env)
- headers = Utils::HeaderHash.new(headers)
- empty = headers['Content-Length'].to_i <= 0
-
- # client or server error, or explicit message
- if (status.to_i >= 400 && empty) || env["rack.showstatus.detail"]
- req = Rack::Request.new(env)
- message = Rack::Utils::HTTP_STATUS_CODES[status.to_i] || status.to_s
- detail = env["rack.showstatus.detail"] || message
- body = @template.result(binding)
- size = Rack::Utils.bytesize(body)
- [status, headers.merge("Content-Type" => "text/html", "Content-Length" => size.to_s), [body]]
- else
- [status, headers, body]
- end
- end
-
- def h(obj) # :nodoc:
- case obj
- when String
- Utils.escape_html(obj)
- else
- Utils.escape_html(obj.inspect)
- end
- end
-
- # :stopdoc:
-
-# adapted from Django
-# Copyright (c) 2005, the Lawrence Journal-World
-# Used under the modified BSD license:
-# http://www.xfree86.org/3.3.6/COPYRIGHT2.html#5
-TEMPLATE = <<'HTML'
-
-
-
-
- <%=h message %> at <%=h req.script_name + req.path_info %>
-
-
-
-
-
-
<%=h message %> (<%= status.to_i %>)
-
-
-
-
-
-
- You're seeing this error because you use Rack::ShowStatus.
-
-
-
-
-HTML
-
- # :startdoc:
- end
-end
diff --git a/vendor/gems/rack-1.1.0/lib/rack/static.rb b/vendor/gems/rack-1.1.0/lib/rack/static.rb
deleted file mode 100644
index 168e8f83..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack/static.rb
+++ /dev/null
@@ -1,38 +0,0 @@
-module Rack
-
- # The Rack::Static middleware intercepts requests for static files
- # (javascript files, images, stylesheets, etc) based on the url prefixes
- # passed in the options, and serves them using a Rack::File object. This
- # allows a Rack stack to serve both static and dynamic content.
- #
- # Examples:
- # use Rack::Static, :urls => ["/media"]
- # will serve all requests beginning with /media from the "media" folder
- # located in the current directory (ie media/*).
- #
- # use Rack::Static, :urls => ["/css", "/images"], :root => "public"
- # will serve all requests beginning with /css or /images from the folder
- # "public" in the current directory (ie public/css/* and public/images/*)
-
- class Static
-
- def initialize(app, options={})
- @app = app
- @urls = options[:urls] || ["/favicon.ico"]
- root = options[:root] || Dir.pwd
- @file_server = Rack::File.new(root)
- end
-
- def call(env)
- path = env["PATH_INFO"]
- can_serve = @urls.any? { |url| path.index(url) == 0 }
-
- if can_serve
- @file_server.call(env)
- else
- @app.call(env)
- end
- end
-
- end
-end
diff --git a/vendor/gems/rack-1.1.0/lib/rack/urlmap.rb b/vendor/gems/rack-1.1.0/lib/rack/urlmap.rb
deleted file mode 100644
index b699d35b..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack/urlmap.rb
+++ /dev/null
@@ -1,56 +0,0 @@
-module Rack
- # Rack::URLMap takes a hash mapping urls or paths to apps, and
- # dispatches accordingly. Support for HTTP/1.1 host names exists if
- # the URLs start with http:// or https://.
- #
- # URLMap modifies the SCRIPT_NAME and PATH_INFO such that the part
- # relevant for dispatch is in the SCRIPT_NAME, and the rest in the
- # PATH_INFO. This should be taken care of when you need to
- # reconstruct the URL in order to create links.
- #
- # URLMap dispatches in such a way that the longest paths are tried
- # first, since they are most specific.
-
- class URLMap
- def initialize(map = {})
- remap(map)
- end
-
- def remap(map)
- @mapping = map.map { |location, app|
- if location =~ %r{\Ahttps?://(.*?)(/.*)}
- host, location = $1, $2
- else
- host = nil
- end
-
- unless location[0] == ?/
- raise ArgumentError, "paths need to start with /"
- end
- location = location.chomp('/')
- match = Regexp.new("^#{Regexp.quote(location).gsub('/', '/+')}(.*)", nil, 'n')
-
- [host, location, match, app]
- }.sort_by { |(h, l, m, a)| [h ? -h.size : (-1.0 / 0.0), -l.size] } # Longest path first
- end
-
- def call(env)
- path = env["PATH_INFO"].to_s
- script_name = env['SCRIPT_NAME']
- hHost, sName, sPort = env.values_at('HTTP_HOST','SERVER_NAME','SERVER_PORT')
- @mapping.each { |host, location, match, app|
- next unless (hHost == host || sName == host \
- || (host.nil? && (hHost == sName || hHost == sName+':'+sPort)))
- next unless path =~ match && rest = $1
- next unless rest.empty? || rest[0] == ?/
-
- return app.call(
- env.merge(
- 'SCRIPT_NAME' => (script_name + location),
- 'PATH_INFO' => rest))
- }
- [404, {"Content-Type" => "text/plain", "X-Cascade" => "pass"}, ["Not Found: #{path}"]]
- end
- end
-end
-
diff --git a/vendor/gems/rack-1.1.0/lib/rack/utils.rb b/vendor/gems/rack-1.1.0/lib/rack/utils.rb
deleted file mode 100644
index 68fd6ace..00000000
--- a/vendor/gems/rack-1.1.0/lib/rack/utils.rb
+++ /dev/null
@@ -1,620 +0,0 @@
-# -*- encoding: binary -*-
-
-require 'set'
-require 'tempfile'
-
-module Rack
- # Rack::Utils contains a grab-bag of useful methods for writing web
- # applications adopted from all kinds of Ruby libraries.
-
- module Utils
- # Performs URI escaping so that you can construct proper
- # query strings faster. Use this rather than the cgi.rb
- # version since it's faster. (Stolen from Camping).
- def escape(s)
- s.to_s.gsub(/([^ a-zA-Z0-9_.-]+)/n) {
- '%'+$1.unpack('H2'*bytesize($1)).join('%').upcase
- }.tr(' ', '+')
- end
- module_function :escape
-
- # Unescapes a URI escaped string. (Stolen from Camping).
- def unescape(s)
- s.tr('+', ' ').gsub(/((?:%[0-9a-fA-F]{2})+)/n){
- [$1.delete('%')].pack('H*')
- }
- end
- module_function :unescape
-
- DEFAULT_SEP = /[&;] */n
-
- # Stolen from Mongrel, with some small modifications:
- # Parses a query string by breaking it up at the '&'
- # and ';' characters. You can also use this to parse
- # cookies by changing the characters used in the second
- # parameter (which defaults to '&;').
- def parse_query(qs, d = nil)
- params = {}
-
- (qs || '').split(d ? /[#{d}] */n : DEFAULT_SEP).each do |p|
- k, v = p.split('=', 2).map { |x| unescape(x) }
- if v =~ /^("|')(.*)\1$/
- v = $2.gsub('\\'+$1, $1)
- end
- if cur = params[k]
- if cur.class == Array
- params[k] << v
- else
- params[k] = [cur, v]
- end
- else
- params[k] = v
- end
- end
-
- return params
- end
- module_function :parse_query
-
- def parse_nested_query(qs, d = nil)
- params = {}
-
- (qs || '').split(d ? /[#{d}] */n : DEFAULT_SEP).each do |p|
- k, v = unescape(p).split('=', 2)
- normalize_params(params, k, v)
- end
-
- return params
- end
- module_function :parse_nested_query
-
- def normalize_params(params, name, v = nil)
- if v and v =~ /^("|')(.*)\1$/
- v = $2.gsub('\\'+$1, $1)
- end
- name =~ %r(\A[\[\]]*([^\[\]]+)\]*)
- k = $1 || ''
- after = $' || ''
-
- return if k.empty?
-
- if after == ""
- params[k] = v
- elsif after == "[]"
- params[k] ||= []
- raise TypeError, "expected Array (got #{params[k].class.name}) for param `#{k}'" unless params[k].is_a?(Array)
- params[k] << v
- elsif after =~ %r(^\[\]\[([^\[\]]+)\]$) || after =~ %r(^\[\](.+)$)
- child_key = $1
- params[k] ||= []
- raise TypeError, "expected Array (got #{params[k].class.name}) for param `#{k}'" unless params[k].is_a?(Array)
- if params[k].last.is_a?(Hash) && !params[k].last.key?(child_key)
- normalize_params(params[k].last, child_key, v)
- else
- params[k] << normalize_params({}, child_key, v)
- end
- else
- params[k] ||= {}
- raise TypeError, "expected Hash (got #{params[k].class.name}) for param `#{k}'" unless params[k].is_a?(Hash)
- params[k] = normalize_params(params[k], after, v)
- end
-
- return params
- end
- module_function :normalize_params
-
- def build_query(params)
- params.map { |k, v|
- if v.class == Array
- build_query(v.map { |x| [k, x] })
- else
- "#{escape(k)}=#{escape(v)}"
- end
- }.join("&")
- end
- module_function :build_query
-
- def build_nested_query(value, prefix = nil)
- case value
- when Array
- value.map { |v|
- build_nested_query(v, "#{prefix}[]")
- }.join("&")
- when Hash
- value.map { |k, v|
- build_nested_query(v, prefix ? "#{prefix}[#{escape(k)}]" : escape(k))
- }.join("&")
- when String
- raise ArgumentError, "value must be a Hash" if prefix.nil?
- "#{prefix}=#{escape(value)}"
- else
- prefix
- end
- end
- module_function :build_nested_query
-
- # Escape ampersands, brackets and quotes to their HTML/XML entities.
- def escape_html(string)
- string.to_s.gsub("&", "&").
- gsub("<", "<").
- gsub(">", ">").
- gsub("'", "'").
- gsub('"', """)
- end
- module_function :escape_html
-
- def select_best_encoding(available_encodings, accept_encoding)
- # http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
-
- expanded_accept_encoding =
- accept_encoding.map { |m, q|
- if m == "*"
- (available_encodings - accept_encoding.map { |m2, _| m2 }).map { |m2| [m2, q] }
- else
- [[m, q]]
- end
- }.inject([]) { |mem, list|
- mem + list
- }
-
- encoding_candidates = expanded_accept_encoding.sort_by { |_, q| -q }.map { |m, _| m }
-
- unless encoding_candidates.include?("identity")
- encoding_candidates.push("identity")
- end
-
- expanded_accept_encoding.find_all { |m, q|
- q == 0.0
- }.each { |m, _|
- encoding_candidates.delete(m)
- }
-
- return (encoding_candidates & available_encodings)[0]
- end
- module_function :select_best_encoding
-
- def set_cookie_header!(header, key, value)
- case value
- when Hash
- domain = "; domain=" + value[:domain] if value[:domain]
- path = "; path=" + value[:path] if value[:path]
- # According to RFC 2109, we need dashes here.
- # N.B.: cgi.rb uses spaces...
- expires = "; expires=" + value[:expires].clone.gmtime.
- strftime("%a, %d-%b-%Y %H:%M:%S GMT") if value[:expires]
- secure = "; secure" if value[:secure]
- httponly = "; HttpOnly" if value[:httponly]
- value = value[:value]
- end
- value = [value] unless Array === value
- cookie = escape(key) + "=" +
- value.map { |v| escape v }.join("&") +
- "#{domain}#{path}#{expires}#{secure}#{httponly}"
-
- case header["Set-Cookie"]
- when Array
- header["Set-Cookie"] << cookie
- when String
- header["Set-Cookie"] = [header["Set-Cookie"], cookie]
- when nil
- header["Set-Cookie"] = cookie
- end
-
- nil
- end
- module_function :set_cookie_header!
-
- def delete_cookie_header!(header, key, value = {})
- unless Array === header["Set-Cookie"]
- header["Set-Cookie"] = [header["Set-Cookie"]].compact
- end
-
- header["Set-Cookie"].reject! { |cookie|
- cookie =~ /\A#{escape(key)}=/
- }
-
- set_cookie_header!(header, key,
- {:value => '', :path => nil, :domain => nil,
- :expires => Time.at(0) }.merge(value))
-
- nil
- end
- module_function :delete_cookie_header!
-
- # Return the bytesize of String; uses String#length under Ruby 1.8 and
- # String#bytesize under 1.9.
- if ''.respond_to?(:bytesize)
- def bytesize(string)
- string.bytesize
- end
- else
- def bytesize(string)
- string.size
- end
- end
- module_function :bytesize
-
- # Context allows the use of a compatible middleware at different points
- # in a request handling stack. A compatible middleware must define
- # #context which should take the arguments env and app. The first of which
- # would be the request environment. The second of which would be the rack
- # application that the request would be forwarded to.
- class Context
- attr_reader :for, :app
-
- def initialize(app_f, app_r)
- raise 'running context does not respond to #context' unless app_f.respond_to? :context
- @for, @app = app_f, app_r
- end
-
- def call(env)
- @for.context(env, @app)
- end
-
- def recontext(app)
- self.class.new(@for, app)
- end
-
- def context(env, app=@app)
- recontext(app).call(env)
- end
- end
-
- # A case-insensitive Hash that preserves the original case of a
- # header when set.
- class HeaderHash < Hash
- def self.new(hash={})
- HeaderHash === hash ? hash : super(hash)
- end
-
- def initialize(hash={})
- super()
- @names = {}
- hash.each { |k, v| self[k] = v }
- end
-
- def each
- super do |k, v|
- yield(k, v.respond_to?(:to_ary) ? v.to_ary.join("\n") : v)
- end
- end
-
- def to_hash
- inject({}) do |hash, (k,v)|
- if v.respond_to? :to_ary
- hash[k] = v.to_ary.join("\n")
- else
- hash[k] = v
- end
- hash
- end
- end
-
- def [](k)
- super(@names[k] ||= @names[k.downcase])
- end
-
- def []=(k, v)
- delete k
- @names[k] = @names[k.downcase] = k
- super k, v
- end
-
- def delete(k)
- canonical = k.downcase
- result = super @names.delete(canonical)
- @names.delete_if { |name,| name.downcase == canonical }
- result
- end
-
- def include?(k)
- @names.include?(k) || @names.include?(k.downcase)
- end
-
- alias_method :has_key?, :include?
- alias_method :member?, :include?
- alias_method :key?, :include?
-
- def merge!(other)
- other.each { |k, v| self[k] = v }
- self
- end
-
- def merge(other)
- hash = dup
- hash.merge! other
- end
-
- def replace(other)
- clear
- other.each { |k, v| self[k] = v }
- self
- end
- end
-
- # Every standard HTTP code mapped to the appropriate message.
- # Generated with:
- # curl -s http://www.iana.org/assignments/http-status-codes | \
- # ruby -ane 'm = /^(\d{3}) +(\S[^\[(]+)/.match($_) and
- # puts " #{m[1]} => \x27#{m[2].strip}x27,"'
- HTTP_STATUS_CODES = {
- 100 => 'Continue',
- 101 => 'Switching Protocols',
- 102 => 'Processing',
- 200 => 'OK',
- 201 => 'Created',
- 202 => 'Accepted',
- 203 => 'Non-Authoritative Information',
- 204 => 'No Content',
- 205 => 'Reset Content',
- 206 => 'Partial Content',
- 207 => 'Multi-Status',
- 226 => 'IM Used',
- 300 => 'Multiple Choices',
- 301 => 'Moved Permanently',
- 302 => 'Found',
- 303 => 'See Other',
- 304 => 'Not Modified',
- 305 => 'Use Proxy',
- 306 => 'Reserved',
- 307 => 'Temporary Redirect',
- 400 => 'Bad Request',
- 401 => 'Unauthorized',
- 402 => 'Payment Required',
- 403 => 'Forbidden',
- 404 => 'Not Found',
- 405 => 'Method Not Allowed',
- 406 => 'Not Acceptable',
- 407 => 'Proxy Authentication Required',
- 408 => 'Request Timeout',
- 409 => 'Conflict',
- 410 => 'Gone',
- 411 => 'Length Required',
- 412 => 'Precondition Failed',
- 413 => 'Request Entity Too Large',
- 414 => 'Request-URI Too Long',
- 415 => 'Unsupported Media Type',
- 416 => 'Requested Range Not Satisfiable',
- 417 => 'Expectation Failed',
- 422 => 'Unprocessable Entity',
- 423 => 'Locked',
- 424 => 'Failed Dependency',
- 426 => 'Upgrade Required',
- 500 => 'Internal Server Error',
- 501 => 'Not Implemented',
- 502 => 'Bad Gateway',
- 503 => 'Service Unavailable',
- 504 => 'Gateway Timeout',
- 505 => 'HTTP Version Not Supported',
- 506 => 'Variant Also Negotiates',
- 507 => 'Insufficient Storage',
- 510 => 'Not Extended',
- }
-
- # Responses with HTTP status codes that should not have an entity body
- STATUS_WITH_NO_ENTITY_BODY = Set.new((100..199).to_a << 204 << 304)
-
- SYMBOL_TO_STATUS_CODE = HTTP_STATUS_CODES.inject({}) { |hash, (code, message)|
- hash[message.downcase.gsub(/\s|-/, '_').to_sym] = code
- hash
- }
-
- def status_code(status)
- if status.is_a?(Symbol)
- SYMBOL_TO_STATUS_CODE[status] || 500
- else
- status.to_i
- end
- end
- module_function :status_code
-
- # A multipart form data parser, adapted from IOWA.
- #
- # Usually, Rack::Request#POST takes care of calling this.
-
- module Multipart
- class UploadedFile
- # The filename, *not* including the path, of the "uploaded" file
- attr_reader :original_filename
-
- # The content type of the "uploaded" file
- attr_accessor :content_type
-
- def initialize(path, content_type = "text/plain", binary = false)
- raise "#{path} file does not exist" unless ::File.exist?(path)
- @content_type = content_type
- @original_filename = ::File.basename(path)
- @tempfile = Tempfile.new(@original_filename)
- @tempfile.set_encoding(Encoding::BINARY) if @tempfile.respond_to?(:set_encoding)
- @tempfile.binmode if binary
- FileUtils.copy_file(path, @tempfile.path)
- end
-
- def path
- @tempfile.path
- end
- alias_method :local_path, :path
-
- def method_missing(method_name, *args, &block) #:nodoc:
- @tempfile.__send__(method_name, *args, &block)
- end
- end
-
- EOL = "\r\n"
- MULTIPART_BOUNDARY = "AaB03x"
-
- def self.parse_multipart(env)
- unless env['CONTENT_TYPE'] =~
- %r|\Amultipart/.*boundary=\"?([^\";,]+)\"?|n
- nil
- else
- boundary = "--#{$1}"
-
- params = {}
- buf = ""
- content_length = env['CONTENT_LENGTH'].to_i
- input = env['rack.input']
- input.rewind
-
- boundary_size = Utils.bytesize(boundary) + EOL.size
- bufsize = 16384
-
- content_length -= boundary_size
-
- read_buffer = ''
-
- status = input.read(boundary_size, read_buffer)
- raise EOFError, "bad content body" unless status == boundary + EOL
-
- rx = /(?:#{EOL})?#{Regexp.quote boundary}(#{EOL}|--)/n
-
- loop {
- head = nil
- body = ''
- filename = content_type = name = nil
-
- until head && buf =~ rx
- if !head && i = buf.index(EOL+EOL)
- head = buf.slice!(0, i+2) # First \r\n
- buf.slice!(0, 2) # Second \r\n
-
- filename = head[/Content-Disposition:.* filename=(?:"((?:\\.|[^\"])*)"|([^;\s]*))/ni, 1]
- content_type = head[/Content-Type: (.*)#{EOL}/ni, 1]
- name = head[/Content-Disposition:.*\s+name="?([^\";]*)"?/ni, 1] || head[/Content-ID:\s*([^#{EOL}]*)/ni, 1]
-
- if content_type || filename
- body = Tempfile.new("RackMultipart")
- body.binmode if body.respond_to?(:binmode)
- end
-
- next
- end
-
- # Save the read body part.
- if head && (boundary_size+4 < buf.size)
- body << buf.slice!(0, buf.size - (boundary_size+4))
- end
-
- c = input.read(bufsize < content_length ? bufsize : content_length, read_buffer)
- raise EOFError, "bad content body" if c.nil? || c.empty?
- buf << c
- content_length -= c.size
- end
-
- # Save the rest.
- if i = buf.index(rx)
- body << buf.slice!(0, i)
- buf.slice!(0, boundary_size+2)
-
- content_length = -1 if $1 == "--"
- end
-
- if filename == ""
- # filename is blank which means no file has been selected
- data = nil
- elsif filename
- body.rewind
-
- # Take the basename of the upload's original filename.
- # This handles the full Windows paths given by Internet Explorer
- # (and perhaps other broken user agents) without affecting
- # those which give the lone filename.
- filename =~ /^(?:.*[:\\\/])?(.*)/m
- filename = $1
-
- data = {:filename => filename, :type => content_type,
- :name => name, :tempfile => body, :head => head}
- elsif !filename && content_type
- body.rewind
-
- # Generic multipart cases, not coming from a form
- data = {:type => content_type,
- :name => name, :tempfile => body, :head => head}
- else
- data = body
- end
-
- Utils.normalize_params(params, name, data) unless data.nil?
-
- # break if we're at the end of a buffer, but not if it is the end of a field
- break if (buf.empty? && $1 != EOL) || content_length == -1
- }
-
- input.rewind
-
- params
- end
- end
-
- def self.build_multipart(params, first = true)
- if first
- unless params.is_a?(Hash)
- raise ArgumentError, "value must be a Hash"
- end
-
- multipart = false
- query = lambda { |value|
- case value
- when Array
- value.each(&query)
- when Hash
- value.values.each(&query)
- when UploadedFile
- multipart = true
- end
- }
- params.values.each(&query)
- return nil unless multipart
- end
-
- flattened_params = Hash.new
-
- params.each do |key, value|
- k = first ? key.to_s : "[#{key}]"
-
- case value
- when Array
- value.map { |v|
- build_multipart(v, false).each { |subkey, subvalue|
- flattened_params["#{k}[]#{subkey}"] = subvalue
- }
- }
- when Hash
- build_multipart(value, false).each { |subkey, subvalue|
- flattened_params[k + subkey] = subvalue
- }
- else
- flattened_params[k] = value
- end
- end
-
- if first
- flattened_params.map { |name, file|
- if file.respond_to?(:original_filename)
- ::File.open(file.path, "rb") do |f|
- f.set_encoding(Encoding::BINARY) if f.respond_to?(:set_encoding)
-<<-EOF
---#{MULTIPART_BOUNDARY}\r
-Content-Disposition: form-data; name="#{name}"; filename="#{Utils.escape(file.original_filename)}"\r
-Content-Type: #{file.content_type}\r
-Content-Length: #{::File.stat(file.path).size}\r
-\r
-#{f.read}\r
-EOF
- end
- else
-<<-EOF
---#{MULTIPART_BOUNDARY}\r
-Content-Disposition: form-data; name="#{name}"\r
-\r
-#{file}\r
-EOF
- end
- }.join + "--#{MULTIPART_BOUNDARY}--\r"
- else
- flattened_params
- end
- end
- end
- end
-end
diff --git a/vendor/gems/rack-1.1.0/rack.gemspec b/vendor/gems/rack-1.1.0/rack.gemspec
deleted file mode 100644
index e28b9bb2..00000000
--- a/vendor/gems/rack-1.1.0/rack.gemspec
+++ /dev/null
@@ -1,38 +0,0 @@
-Gem::Specification.new do |s|
- s.name = "rack"
- s.version = "1.1.0"
- s.platform = Gem::Platform::RUBY
- s.summary = "a modular Ruby webserver interface"
-
- s.description = <<-EOF
-Rack provides minimal, modular and adaptable interface for developing
-web applications in Ruby. By wrapping HTTP requests and responses in
-the simplest way possible, it unifies and distills the API for web
-servers, web frameworks, and software in between (the so-called
-middleware) into a single method call.
-
-Also see http://rack.rubyforge.org.
-EOF
-
- s.files = Dir['{bin/*,contrib/*,example/*,lib/**/*}'] +
- %w(COPYING KNOWN-ISSUES rack.gemspec RDOX README SPEC)
- s.bindir = 'bin'
- s.executables << 'rackup'
- s.require_path = 'lib'
- s.has_rdoc = true
- s.extra_rdoc_files = ['README', 'SPEC', 'KNOWN-ISSUES']
- s.test_files = Dir['test/{test,spec}_*.rb']
-
- s.author = 'Christian Neukirchen'
- s.email = 'chneukirchen@gmail.com'
- s.homepage = 'http://rack.rubyforge.org'
- s.rubyforge_project = 'rack'
-
- s.add_development_dependency 'test-spec'
-
- s.add_development_dependency 'camping'
- s.add_development_dependency 'fcgi'
- s.add_development_dependency 'memcache-client'
- s.add_development_dependency 'mongrel'
- s.add_development_dependency 'thin'
-end
diff --git a/vendor/gems/rack-1.1.0/test/spec_rack_auth_basic.rb b/vendor/gems/rack-1.1.0/test/spec_rack_auth_basic.rb
deleted file mode 100644
index 0176efc8..00000000
--- a/vendor/gems/rack-1.1.0/test/spec_rack_auth_basic.rb
+++ /dev/null
@@ -1,73 +0,0 @@
-require 'test/spec'
-
-require 'rack/auth/basic'
-require 'rack/mock'
-
-context 'Rack::Auth::Basic' do
-
- def realm
- 'WallysWorld'
- end
-
- def unprotected_app
- lambda { |env| [ 200, {'Content-Type' => 'text/plain'}, ["Hi #{env['REMOTE_USER']}"] ] }
- end
-
- def protected_app
- app = Rack::Auth::Basic.new(unprotected_app) { |username, password| 'Boss' == username }
- app.realm = realm
- app
- end
-
- setup do
- @request = Rack::MockRequest.new(protected_app)
- end
-
- def request_with_basic_auth(username, password, &block)
- request 'HTTP_AUTHORIZATION' => 'Basic ' + ["#{username}:#{password}"].pack("m*"), &block
- end
-
- def request(headers = {})
- yield @request.get('/', headers)
- end
-
- def assert_basic_auth_challenge(response)
- response.should.be.a.client_error
- response.status.should.equal 401
- response.should.include 'WWW-Authenticate'
- response.headers['WWW-Authenticate'].should =~ /Basic realm="#{Regexp.escape(realm)}"/
- response.body.should.be.empty
- end
-
- specify 'should challenge correctly when no credentials are specified' do
- request do |response|
- assert_basic_auth_challenge response
- end
- end
-
- specify 'should rechallenge if incorrect credentials are specified' do
- request_with_basic_auth 'joe', 'password' do |response|
- assert_basic_auth_challenge response
- end
- end
-
- specify 'should return application output if correct credentials are specified' do
- request_with_basic_auth 'Boss', 'password' do |response|
- response.status.should.equal 200
- response.body.to_s.should.equal 'Hi Boss'
- end
- end
-
- specify 'should return 400 Bad Request if different auth scheme used' do
- request 'HTTP_AUTHORIZATION' => 'Digest params' do |response|
- response.should.be.a.client_error
- response.status.should.equal 400
- response.should.not.include 'WWW-Authenticate'
- end
- end
-
- specify 'realm as optional constructor arg' do
- app = Rack::Auth::Basic.new(unprotected_app, realm) { true }
- assert_equal realm, app.realm
- end
-end
diff --git a/vendor/gems/rack-1.1.0/test/spec_rack_auth_digest.rb b/vendor/gems/rack-1.1.0/test/spec_rack_auth_digest.rb
deleted file mode 100644
index a980acc8..00000000
--- a/vendor/gems/rack-1.1.0/test/spec_rack_auth_digest.rb
+++ /dev/null
@@ -1,226 +0,0 @@
-require 'test/spec'
-
-require 'rack/auth/digest/md5'
-require 'rack/mock'
-
-context 'Rack::Auth::Digest::MD5' do
-
- def realm
- 'WallysWorld'
- end
-
- def unprotected_app
- lambda do |env|
- [ 200, {'Content-Type' => 'text/plain'}, ["Hi #{env['REMOTE_USER']}"] ]
- end
- end
-
- def protected_app
- app = Rack::Auth::Digest::MD5.new(unprotected_app) do |username|
- { 'Alice' => 'correct-password' }[username]
- end
- app.realm = realm
- app.opaque = 'this-should-be-secret'
- app
- end
-
- def protected_app_with_hashed_passwords
- app = Rack::Auth::Digest::MD5.new(unprotected_app) do |username|
- username == 'Alice' ? Digest::MD5.hexdigest("Alice:#{realm}:correct-password") : nil
- end
- app.realm = realm
- app.opaque = 'this-should-be-secret'
- app.passwords_hashed = true
- app
- end
-
- def partially_protected_app
- Rack::URLMap.new({
- '/' => unprotected_app,
- '/protected' => protected_app
- })
- end
-
- def protected_app_with_method_override
- Rack::MethodOverride.new(protected_app)
- end
-
- setup do
- @request = Rack::MockRequest.new(protected_app)
- end
-
- def request(method, path, headers = {}, &block)
- response = @request.request(method, path, headers)
- block.call(response) if block
- return response
- end
-
- class MockDigestRequest
- def initialize(params)
- @params = params
- end
- def method_missing(sym)
- if @params.has_key? k = sym.to_s
- return @params[k]
- end
- super
- end
- def method
- @params['method']
- end
- def response(password)
- Rack::Auth::Digest::MD5.new(nil).send :digest, self, password
- end
- end
-
- def request_with_digest_auth(method, path, username, password, options = {}, &block)
- request_options = {}
- request_options[:input] = options.delete(:input) if options.include? :input
-
- response = request(method, path, request_options)
-
- return response unless response.status == 401
-
- if wait = options.delete(:wait)
- sleep wait
- end
-
- challenge = response['WWW-Authenticate'].split(' ', 2).last
-
- params = Rack::Auth::Digest::Params.parse(challenge)
-
- params['username'] = username
- params['nc'] = '00000001'
- params['cnonce'] = 'nonsensenonce'
- params['uri'] = path
-
- params['method'] = method
-
- params.update options
-
- params['response'] = MockDigestRequest.new(params).response(password)
-
- request(method, path, request_options.merge('HTTP_AUTHORIZATION' => "Digest #{params}"), &block)
- end
-
- def assert_digest_auth_challenge(response)
- response.should.be.a.client_error
- response.status.should.equal 401
- response.should.include 'WWW-Authenticate'
- response.headers['WWW-Authenticate'].should =~ /^Digest /
- response.body.should.be.empty
- end
-
- def assert_bad_request(response)
- response.should.be.a.client_error
- response.status.should.equal 400
- response.should.not.include 'WWW-Authenticate'
- end
-
- specify 'should challenge when no credentials are specified' do
- request 'GET', '/' do |response|
- assert_digest_auth_challenge response
- end
- end
-
- specify 'should return application output if correct credentials given' do
- request_with_digest_auth 'GET', '/', 'Alice', 'correct-password' do |response|
- response.status.should.equal 200
- response.body.to_s.should.equal 'Hi Alice'
- end
- end
-
- specify 'should return application output if correct credentials given (hashed passwords)' do
- @request = Rack::MockRequest.new(protected_app_with_hashed_passwords)
-
- request_with_digest_auth 'GET', '/', 'Alice', 'correct-password' do |response|
- response.status.should.equal 200
- response.body.to_s.should.equal 'Hi Alice'
- end
- end
-
- specify 'should rechallenge if incorrect username given' do
- request_with_digest_auth 'GET', '/', 'Bob', 'correct-password' do |response|
- assert_digest_auth_challenge response
- end
- end
-
- specify 'should rechallenge if incorrect password given' do
- request_with_digest_auth 'GET', '/', 'Alice', 'wrong-password' do |response|
- assert_digest_auth_challenge response
- end
- end
-
- specify 'should rechallenge with stale parameter if nonce is stale' do
- begin
- Rack::Auth::Digest::Nonce.time_limit = 1
-
- request_with_digest_auth 'GET', '/', 'Alice', 'correct-password', :wait => 2 do |response|
- assert_digest_auth_challenge response
- response.headers['WWW-Authenticate'].should =~ /\bstale=true\b/
- end
- ensure
- Rack::Auth::Digest::Nonce.time_limit = nil
- end
- end
-
- specify 'should return 400 Bad Request if incorrect qop given' do
- request_with_digest_auth 'GET', '/', 'Alice', 'correct-password', 'qop' => 'auth-int' do |response|
- assert_bad_request response
- end
- end
-
- specify 'should return 400 Bad Request if incorrect uri given' do
- request_with_digest_auth 'GET', '/', 'Alice', 'correct-password', 'uri' => '/foo' do |response|
- assert_bad_request response
- end
- end
-
- specify 'should return 400 Bad Request if different auth scheme used' do
- request 'GET', '/', 'HTTP_AUTHORIZATION' => 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==' do |response|
- assert_bad_request response
- end
- end
-
- specify 'should not require credentials for unprotected path' do
- @request = Rack::MockRequest.new(partially_protected_app)
- request 'GET', '/' do |response|
- response.should.be.ok
- end
- end
-
- specify 'should challenge when no credentials are specified for protected path' do
- @request = Rack::MockRequest.new(partially_protected_app)
- request 'GET', '/protected' do |response|
- assert_digest_auth_challenge response
- end
- end
-
- specify 'should return application output if correct credentials given for protected path' do
- @request = Rack::MockRequest.new(partially_protected_app)
- request_with_digest_auth 'GET', '/protected', 'Alice', 'correct-password' do |response|
- response.status.should.equal 200
- response.body.to_s.should.equal 'Hi Alice'
- end
- end
-
- specify 'should return application output if correct credentials given for POST' do
- request_with_digest_auth 'POST', '/', 'Alice', 'correct-password' do |response|
- response.status.should.equal 200
- response.body.to_s.should.equal 'Hi Alice'
- end
- end
-
- specify 'should return application output if correct credentials given for PUT (using method override of POST)' do
- @request = Rack::MockRequest.new(protected_app_with_method_override)
- request_with_digest_auth 'POST', '/', 'Alice', 'correct-password', :input => "_method=put" do |response|
- response.status.should.equal 200
- response.body.to_s.should.equal 'Hi Alice'
- end
- end
-
- specify 'realm as optional constructor arg' do
- app = Rack::Auth::Digest::MD5.new(unprotected_app, realm) { true }
- assert_equal realm, app.realm
- end
-end
diff --git a/vendor/gems/rack-1.1.0/test/spec_rack_builder.rb b/vendor/gems/rack-1.1.0/test/spec_rack_builder.rb
deleted file mode 100644
index 3fad9810..00000000
--- a/vendor/gems/rack-1.1.0/test/spec_rack_builder.rb
+++ /dev/null
@@ -1,84 +0,0 @@
-require 'test/spec'
-
-require 'rack/builder'
-require 'rack/mock'
-require 'rack/showexceptions'
-require 'rack/auth/basic'
-
-context "Rack::Builder" do
- specify "chains apps by default" do
- app = Rack::Builder.new do
- use Rack::ShowExceptions
- run lambda { |env| raise "bzzzt" }
- end.to_app
-
- Rack::MockRequest.new(app).get("/").should.be.server_error
- Rack::MockRequest.new(app).get("/").should.be.server_error
- Rack::MockRequest.new(app).get("/").should.be.server_error
- end
-
- specify "has implicit #to_app" do
- app = Rack::Builder.new do
- use Rack::ShowExceptions
- run lambda { |env| raise "bzzzt" }
- end
-
- Rack::MockRequest.new(app).get("/").should.be.server_error
- Rack::MockRequest.new(app).get("/").should.be.server_error
- Rack::MockRequest.new(app).get("/").should.be.server_error
- end
-
- specify "supports blocks on use" do
- app = Rack::Builder.new do
- use Rack::ShowExceptions
- use Rack::Auth::Basic do |username, password|
- 'secret' == password
- end
-
- run lambda { |env| [200, {}, ['Hi Boss']] }
- end
-
- response = Rack::MockRequest.new(app).get("/")
- response.should.be.client_error
- response.status.should.equal 401
-
- # with auth...
- response = Rack::MockRequest.new(app).get("/",
- 'HTTP_AUTHORIZATION' => 'Basic ' + ["joe:secret"].pack("m*"))
- response.status.should.equal 200
- response.body.to_s.should.equal 'Hi Boss'
- end
-
- specify "has explicit #to_app" do
- app = Rack::Builder.app do
- use Rack::ShowExceptions
- run lambda { |env| raise "bzzzt" }
- end
-
- Rack::MockRequest.new(app).get("/").should.be.server_error
- Rack::MockRequest.new(app).get("/").should.be.server_error
- Rack::MockRequest.new(app).get("/").should.be.server_error
- end
-
- specify "apps are initialized once" do
- app = Rack::Builder.new do
- class AppClass
- def initialize
- @called = 0
- end
- def call(env)
- raise "bzzzt" if @called > 0
- @called += 1
- [200, {'Content-Type' => 'text/plain'}, ['OK']]
- end
- end
-
- use Rack::ShowExceptions
- run AppClass.new
- end
-
- Rack::MockRequest.new(app).get("/").status.should.equal 200
- Rack::MockRequest.new(app).get("/").should.be.server_error
- end
-
-end
diff --git a/vendor/gems/rack-1.1.0/test/spec_rack_camping.rb b/vendor/gems/rack-1.1.0/test/spec_rack_camping.rb
deleted file mode 100644
index bed11710..00000000
--- a/vendor/gems/rack-1.1.0/test/spec_rack_camping.rb
+++ /dev/null
@@ -1,51 +0,0 @@
-require 'test/spec'
-require 'stringio'
-require 'uri'
-
-begin
- require 'rack/mock'
-
- $-w, w = nil, $-w # yuck
- require 'camping'
- require 'rack/adapter/camping'
-
- Camping.goes :CampApp
- module CampApp
- module Controllers
- class HW < R('/')
- def get
- @headers["X-Served-By"] = URI("http://rack.rubyforge.org")
- "Camping works!"
- end
-
- def post
- "Data: #{input.foo}"
- end
- end
- end
- end
- $-w = w
-
- context "Rack::Adapter::Camping" do
- specify "works with GET" do
- res = Rack::MockRequest.new(Rack::Adapter::Camping.new(CampApp)).
- get("/")
-
- res.should.be.ok
- res["Content-Type"].should.equal "text/html"
- res["X-Served-By"].should.equal "http://rack.rubyforge.org"
-
- res.body.should.equal "Camping works!"
- end
-
- specify "works with POST" do
- res = Rack::MockRequest.new(Rack::Adapter::Camping.new(CampApp)).
- post("/", :input => "foo=bar")
-
- res.should.be.ok
- res.body.should.equal "Data: bar"
- end
- end
-rescue LoadError
- $stderr.puts "Skipping Rack::Adapter::Camping tests (Camping is required). `gem install camping` and try again."
-end
diff --git a/vendor/gems/rack-1.1.0/test/spec_rack_cascade.rb b/vendor/gems/rack-1.1.0/test/spec_rack_cascade.rb
deleted file mode 100644
index cf3c29b4..00000000
--- a/vendor/gems/rack-1.1.0/test/spec_rack_cascade.rb
+++ /dev/null
@@ -1,48 +0,0 @@
-require 'test/spec'
-
-require 'rack/cascade'
-require 'rack/mock'
-
-require 'rack/urlmap'
-require 'rack/file'
-
-context "Rack::Cascade" do
- docroot = File.expand_path(File.dirname(__FILE__))
- app1 = Rack::File.new(docroot)
-
- app2 = Rack::URLMap.new("/crash" => lambda { |env| raise "boom" })
-
- app3 = Rack::URLMap.new("/foo" => lambda { |env|
- [200, { "Content-Type" => "text/plain"}, [""]]})
-
- specify "should dispatch onward on 404 by default" do
- cascade = Rack::Cascade.new([app1, app2, app3])
- Rack::MockRequest.new(cascade).get("/cgi/test").should.be.ok
- Rack::MockRequest.new(cascade).get("/foo").should.be.ok
- Rack::MockRequest.new(cascade).get("/toobad").should.be.not_found
- Rack::MockRequest.new(cascade).get("/cgi/../bla").should.be.forbidden
- end
-
- specify "should dispatch onward on whatever is passed" do
- cascade = Rack::Cascade.new([app1, app2, app3], [404, 403])
- Rack::MockRequest.new(cascade).get("/cgi/../bla").should.be.not_found
- end
-
- specify "should return 404 if empty" do
- Rack::MockRequest.new(Rack::Cascade.new([])).get('/').should.be.not_found
- end
-
- specify "should append new app" do
- cascade = Rack::Cascade.new([], [404, 403])
- Rack::MockRequest.new(cascade).get('/').should.be.not_found
- cascade << app2
- Rack::MockRequest.new(cascade).get('/cgi/test').should.be.not_found
- Rack::MockRequest.new(cascade).get('/cgi/../bla').should.be.not_found
- cascade << app1
- Rack::MockRequest.new(cascade).get('/cgi/test').should.be.ok
- Rack::MockRequest.new(cascade).get('/cgi/../bla').should.be.forbidden
- Rack::MockRequest.new(cascade).get('/foo').should.be.not_found
- cascade << app3
- Rack::MockRequest.new(cascade).get('/foo').should.be.ok
- end
-end
diff --git a/vendor/gems/rack-1.1.0/test/spec_rack_cgi.rb b/vendor/gems/rack-1.1.0/test/spec_rack_cgi.rb
deleted file mode 100644
index 59500cd7..00000000
--- a/vendor/gems/rack-1.1.0/test/spec_rack_cgi.rb
+++ /dev/null
@@ -1,89 +0,0 @@
-require 'test/spec'
-require 'testrequest'
-
-context "Rack::Handler::CGI" do
- include TestRequest::Helpers
-
- setup do
- @host = '0.0.0.0'
- @port = 9203
- end
-
- # Keep this first.
- specify "startup" do
- $pid = fork {
- Dir.chdir(File.join(File.dirname(__FILE__), "..", "test", "cgi"))
- exec "lighttpd -D -f lighttpd.conf"
- }
- end
-
- specify "should respond" do
- sleep 1
- lambda {
- GET("/test")
- }.should.not.raise
- end
-
- specify "should be a lighttpd" do
- GET("/test")
- status.should.be 200
- response["SERVER_SOFTWARE"].should =~ /lighttpd/
- response["HTTP_VERSION"].should.equal "HTTP/1.1"
- response["SERVER_PROTOCOL"].should.equal "HTTP/1.1"
- response["SERVER_PORT"].should.equal @port.to_s
- response["SERVER_NAME"].should =~ @host
- end
-
- specify "should have rack headers" do
- GET("/test")
- response["rack.version"].should.equal [1,1]
- response["rack.multithread"].should.be false
- response["rack.multiprocess"].should.be true
- response["rack.run_once"].should.be true
- end
-
- specify "should have CGI headers on GET" do
- GET("/test")
- response["REQUEST_METHOD"].should.equal "GET"
- response["SCRIPT_NAME"].should.equal "/test"
- response["REQUEST_PATH"].should.equal "/"
- response["PATH_INFO"].should.equal ""
- response["QUERY_STRING"].should.equal ""
- response["test.postdata"].should.equal ""
-
- GET("/test/foo?quux=1")
- response["REQUEST_METHOD"].should.equal "GET"
- response["SCRIPT_NAME"].should.equal "/test"
- response["REQUEST_PATH"].should.equal "/"
- response["PATH_INFO"].should.equal "/foo"
- response["QUERY_STRING"].should.equal "quux=1"
- end
-
- specify "should have CGI headers on POST" do
- POST("/test", {"rack-form-data" => "23"}, {'X-test-header' => '42'})
- status.should.equal 200
- response["REQUEST_METHOD"].should.equal "POST"
- response["SCRIPT_NAME"].should.equal "/test"
- response["REQUEST_PATH"].should.equal "/"
- response["QUERY_STRING"].should.equal ""
- response["HTTP_X_TEST_HEADER"].should.equal "42"
- response["test.postdata"].should.equal "rack-form-data=23"
- end
-
- specify "should support HTTP auth" do
- GET("/test", {:user => "ruth", :passwd => "secret"})
- response["HTTP_AUTHORIZATION"].should.equal "Basic cnV0aDpzZWNyZXQ="
- end
-
- specify "should set status" do
- GET("/test?secret")
- status.should.equal 403
- response["rack.url_scheme"].should.equal "http"
- end
-
- # Keep this last.
- specify "shutdown" do
- Process.kill 15, $pid
- Process.wait($pid).should.equal $pid
- end
-end
diff --git a/vendor/gems/rack-1.1.0/test/spec_rack_chunked.rb b/vendor/gems/rack-1.1.0/test/spec_rack_chunked.rb
deleted file mode 100644
index 39eea482..00000000
--- a/vendor/gems/rack-1.1.0/test/spec_rack_chunked.rb
+++ /dev/null
@@ -1,62 +0,0 @@
-require 'rack/mock'
-require 'rack/chunked'
-require 'rack/utils'
-
-context "Rack::Chunked" do
-
- before do
- @env = Rack::MockRequest.
- env_for('/', 'HTTP_VERSION' => '1.1', 'REQUEST_METHOD' => 'GET')
- end
-
- specify 'chunks responses with no Content-Length' do
- app = lambda { |env| [200, {}, ['Hello', ' ', 'World!']] }
- response = Rack::MockResponse.new(*Rack::Chunked.new(app).call(@env))
- response.headers.should.not.include 'Content-Length'
- response.headers['Transfer-Encoding'].should.equal 'chunked'
- response.body.should.equal "5\r\nHello\r\n1\r\n \r\n6\r\nWorld!\r\n0\r\n\r\n"
- end
-
- specify 'chunks empty bodies properly' do
- app = lambda { |env| [200, {}, []] }
- response = Rack::MockResponse.new(*Rack::Chunked.new(app).call(@env))
- response.headers.should.not.include 'Content-Length'
- response.headers['Transfer-Encoding'].should.equal 'chunked'
- response.body.should.equal "0\r\n\r\n"
- end
-
- specify 'does not modify response when Content-Length header present' do
- app = lambda { |env| [200, {'Content-Length'=>'12'}, ['Hello', ' ', 'World!']] }
- status, headers, body = Rack::Chunked.new(app).call(@env)
- status.should.equal 200
- headers.should.not.include 'Transfer-Encoding'
- headers.should.include 'Content-Length'
- body.join.should.equal 'Hello World!'
- end
-
- specify 'does not modify response when client is HTTP/1.0' do
- app = lambda { |env| [200, {}, ['Hello', ' ', 'World!']] }
- @env['HTTP_VERSION'] = 'HTTP/1.0'
- status, headers, body = Rack::Chunked.new(app).call(@env)
- status.should.equal 200
- headers.should.not.include 'Transfer-Encoding'
- body.join.should.equal 'Hello World!'
- end
-
- specify 'does not modify response when Transfer-Encoding header already present' do
- app = lambda { |env| [200, {'Transfer-Encoding' => 'identity'}, ['Hello', ' ', 'World!']] }
- status, headers, body = Rack::Chunked.new(app).call(@env)
- status.should.equal 200
- headers['Transfer-Encoding'].should.equal 'identity'
- body.join.should.equal 'Hello World!'
- end
-
- [100, 204, 304].each do |status_code|
- specify "does not modify response when status code is #{status_code}" do
- app = lambda { |env| [status_code, {}, []] }
- status, headers, body = Rack::Chunked.new(app).call(@env)
- status.should.equal status_code
- headers.should.not.include 'Transfer-Encoding'
- end
- end
-end
diff --git a/vendor/gems/rack-1.1.0/test/spec_rack_commonlogger.rb b/vendor/gems/rack-1.1.0/test/spec_rack_commonlogger.rb
deleted file mode 100644
index 46a72e86..00000000
--- a/vendor/gems/rack-1.1.0/test/spec_rack_commonlogger.rb
+++ /dev/null
@@ -1,61 +0,0 @@
-require 'test/spec'
-require 'stringio'
-
-require 'rack/commonlogger'
-require 'rack/lobster'
-require 'rack/mock'
-
-context "Rack::CommonLogger" do
- app = lambda { |env|
- [200,
- {"Content-Type" => "text/html", "Content-Length" => length.to_s},
- [obj]]}
- app_without_length = lambda { |env|
- [200,
- {"Content-Type" => "text/html"},
- []]}
- app_with_zero_length = lambda { |env|
- [200,
- {"Content-Type" => "text/html", "Content-Length" => "0"},
- []]}
-
- specify "should log to rack.errors by default" do
- res = Rack::MockRequest.new(Rack::CommonLogger.new(app)).get("/")
-
- res.errors.should.not.be.empty
- res.errors.should =~ /"GET \/ " 200 #{length} /
- end
-
- specify "should log to anything with +write+" do
- log = StringIO.new
- res = Rack::MockRequest.new(Rack::CommonLogger.new(app, log)).get("/")
-
- log.string.should =~ /"GET \/ " 200 #{length} /
- end
-
- specify "should log - content length if header is missing" do
- res = Rack::MockRequest.new(Rack::CommonLogger.new(app_without_length)).get("/")
-
- res.errors.should.not.be.empty
- res.errors.should =~ /"GET \/ " 200 - /
- end
-
- specify "should log - content length if header is zero" do
- res = Rack::MockRequest.new(Rack::CommonLogger.new(app_with_zero_length)).get("/")
-
- res.errors.should.not.be.empty
- res.errors.should =~ /"GET \/ " 200 - /
- end
-
- def length
- self.class.length
- end
-
- def self.length
- 123
- end
-
- def self.obj
- "hello world"
- end
-end
diff --git a/vendor/gems/rack-1.1.0/test/spec_rack_conditionalget.rb b/vendor/gems/rack-1.1.0/test/spec_rack_conditionalget.rb
deleted file mode 100644
index ca34cc92..00000000
--- a/vendor/gems/rack-1.1.0/test/spec_rack_conditionalget.rb
+++ /dev/null
@@ -1,41 +0,0 @@
-require 'test/spec'
-require 'time'
-
-require 'rack/mock'
-require 'rack/conditionalget'
-
-context "Rack::ConditionalGet" do
- specify "should set a 304 status and truncate body when If-Modified-Since hits" do
- timestamp = Time.now.httpdate
- app = Rack::ConditionalGet.new(lambda { |env|
- [200, {'Last-Modified'=>timestamp}, ['TEST']] })
-
- response = Rack::MockRequest.new(app).
- get("/", 'HTTP_IF_MODIFIED_SINCE' => timestamp)
-
- response.status.should.equal 304
- response.body.should.be.empty
- end
-
- specify "should set a 304 status and truncate body when If-None-Match hits" do
- app = Rack::ConditionalGet.new(lambda { |env|
- [200, {'Etag'=>'1234'}, ['TEST']] })
-
- response = Rack::MockRequest.new(app).
- get("/", 'HTTP_IF_NONE_MATCH' => '1234')
-
- response.status.should.equal 304
- response.body.should.be.empty
- end
-
- specify "should not affect non-GET/HEAD requests" do
- app = Rack::ConditionalGet.new(lambda { |env|
- [200, {'Etag'=>'1234'}, ['TEST']] })
-
- response = Rack::MockRequest.new(app).
- post("/", 'HTTP_IF_NONE_MATCH' => '1234')
-
- response.status.should.equal 200
- response.body.should.equal 'TEST'
- end
-end
diff --git a/vendor/gems/rack-1.1.0/test/spec_rack_config.rb b/vendor/gems/rack-1.1.0/test/spec_rack_config.rb
deleted file mode 100644
index a508ea4b..00000000
--- a/vendor/gems/rack-1.1.0/test/spec_rack_config.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-require 'test/spec'
-require 'rack/mock'
-require 'rack/builder'
-require 'rack/content_length'
-require 'rack/config'
-
-context "Rack::Config" do
-
- specify "should accept a block that modifies the environment" do
- app = Rack::Builder.new do
- use Rack::Lint
- use Rack::ContentLength
- use Rack::Config do |env|
- env['greeting'] = 'hello'
- end
- run lambda { |env|
- [200, {'Content-Type' => 'text/plain'}, [env['greeting'] || '']]
- }
- end
- response = Rack::MockRequest.new(app).get('/')
- response.body.should.equal('hello')
- end
-
-end
diff --git a/vendor/gems/rack-1.1.0/test/spec_rack_content_length.rb b/vendor/gems/rack-1.1.0/test/spec_rack_content_length.rb
deleted file mode 100644
index 7db9345f..00000000
--- a/vendor/gems/rack-1.1.0/test/spec_rack_content_length.rb
+++ /dev/null
@@ -1,43 +0,0 @@
-require 'rack/mock'
-require 'rack/content_length'
-
-context "Rack::ContentLength" do
- specify "sets Content-Length on String bodies if none is set" do
- app = lambda { |env| [200, {'Content-Type' => 'text/plain'}, "Hello, World!"] }
- response = Rack::ContentLength.new(app).call({})
- response[1]['Content-Length'].should.equal '13'
- end
-
- specify "sets Content-Length on Array bodies if none is set" do
- app = lambda { |env| [200, {'Content-Type' => 'text/plain'}, ["Hello, World!"]] }
- response = Rack::ContentLength.new(app).call({})
- response[1]['Content-Length'].should.equal '13'
- end
-
- specify "does not set Content-Length on variable length bodies" do
- body = lambda { "Hello World!" }
- def body.each ; yield call ; end
-
- app = lambda { |env| [200, {'Content-Type' => 'text/plain'}, body] }
- response = Rack::ContentLength.new(app).call({})
- response[1]['Content-Length'].should.be.nil
- end
-
- specify "does not change Content-Length if it is already set" do
- app = lambda { |env| [200, {'Content-Type' => 'text/plain', 'Content-Length' => '1'}, "Hello, World!"] }
- response = Rack::ContentLength.new(app).call({})
- response[1]['Content-Length'].should.equal '1'
- end
-
- specify "does not set Content-Length on 304 responses" do
- app = lambda { |env| [304, {'Content-Type' => 'text/plain'}, []] }
- response = Rack::ContentLength.new(app).call({})
- response[1]['Content-Length'].should.equal nil
- end
-
- specify "does not set Content-Length when Transfer-Encoding is chunked" do
- app = lambda { |env| [200, {'Transfer-Encoding' => 'chunked'}, []] }
- response = Rack::ContentLength.new(app).call({})
- response[1]['Content-Length'].should.equal nil
- end
-end
diff --git a/vendor/gems/rack-1.1.0/test/spec_rack_content_type.rb b/vendor/gems/rack-1.1.0/test/spec_rack_content_type.rb
deleted file mode 100644
index 9975b94d..00000000
--- a/vendor/gems/rack-1.1.0/test/spec_rack_content_type.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-require 'rack/mock'
-require 'rack/content_type'
-
-context "Rack::ContentType" do
- specify "sets Content-Type to default text/html if none is set" do
- app = lambda { |env| [200, {}, "Hello, World!"] }
- status, headers, body = Rack::ContentType.new(app).call({})
- headers['Content-Type'].should.equal 'text/html'
- end
-
- specify "sets Content-Type to chosen default if none is set" do
- app = lambda { |env| [200, {}, "Hello, World!"] }
- status, headers, body =
- Rack::ContentType.new(app, 'application/octet-stream').call({})
- headers['Content-Type'].should.equal 'application/octet-stream'
- end
-
- specify "does not change Content-Type if it is already set" do
- app = lambda { |env| [200, {'Content-Type' => 'foo/bar'}, "Hello, World!"] }
- status, headers, body = Rack::ContentType.new(app).call({})
- headers['Content-Type'].should.equal 'foo/bar'
- end
-
- specify "case insensitive detection of Content-Type" do
- app = lambda { |env| [200, {'CONTENT-Type' => 'foo/bar'}, "Hello, World!"] }
- status, headers, body = Rack::ContentType.new(app).call({})
- headers.to_a.select { |k,v| k.downcase == "content-type" }.
- should.equal [["CONTENT-Type","foo/bar"]]
- end
-end
diff --git a/vendor/gems/rack-1.1.0/test/spec_rack_deflater.rb b/vendor/gems/rack-1.1.0/test/spec_rack_deflater.rb
deleted file mode 100644
index c9bb3189..00000000
--- a/vendor/gems/rack-1.1.0/test/spec_rack_deflater.rb
+++ /dev/null
@@ -1,127 +0,0 @@
-require 'test/spec'
-
-require 'rack/mock'
-require 'rack/deflater'
-require 'stringio'
-require 'time' # for Time#httpdate
-
-context "Rack::Deflater" do
- def build_response(status, body, accept_encoding, headers = {})
- body = [body] if body.respond_to? :to_str
- app = lambda { |env| [status, {}, body] }
- request = Rack::MockRequest.env_for("", headers.merge("HTTP_ACCEPT_ENCODING" => accept_encoding))
- response = Rack::Deflater.new(app).call(request)
-
- return response
- end
-
- specify "should be able to deflate bodies that respond to each" do
- body = Object.new
- class << body; def each; yield("foo"); yield("bar"); end; end
-
- response = build_response(200, body, "deflate")
-
- response[0].should.equal(200)
- response[1].should.equal({
- "Content-Encoding" => "deflate",
- "Vary" => "Accept-Encoding"
- })
- buf = ''
- response[2].each { |part| buf << part }
- buf.should.equal("K\313\317OJ,\002\000")
- end
-
- # TODO: This is really just a special case of the above...
- specify "should be able to deflate String bodies" do
- response = build_response(200, "Hello world!", "deflate")
-
- response[0].should.equal(200)
- response[1].should.equal({
- "Content-Encoding" => "deflate",
- "Vary" => "Accept-Encoding"
- })
- buf = ''
- response[2].each { |part| buf << part }
- buf.should.equal("\363H\315\311\311W(\317/\312IQ\004\000")
- end
-
- specify "should be able to gzip bodies that respond to each" do
- body = Object.new
- class << body; def each; yield("foo"); yield("bar"); end; end
-
- response = build_response(200, body, "gzip")
-
- response[0].should.equal(200)
- response[1].should.equal({
- "Content-Encoding" => "gzip",
- "Vary" => "Accept-Encoding",
- })
-
- buf = ''
- response[2].each { |part| buf << part }
- io = StringIO.new(buf)
- gz = Zlib::GzipReader.new(io)
- gz.read.should.equal("foobar")
- gz.close
- end
-
- specify "should be able to fallback to no deflation" do
- response = build_response(200, "Hello world!", "superzip")
-
- response[0].should.equal(200)
- response[1].should.equal({ "Vary" => "Accept-Encoding" })
- response[2].should.equal(["Hello world!"])
- end
-
- specify "should be able to skip when there is no response entity body" do
- response = build_response(304, [], "gzip")
-
- response[0].should.equal(304)
- response[1].should.equal({})
- response[2].should.equal([])
- end
-
- specify "should handle the lack of an acceptable encoding" do
- response1 = build_response(200, "Hello world!", "identity;q=0", "PATH_INFO" => "/")
- response1[0].should.equal(406)
- response1[1].should.equal({"Content-Type" => "text/plain", "Content-Length" => "71"})
- response1[2].should.equal(["An acceptable encoding for the requested resource / could not be found."])
-
- response2 = build_response(200, "Hello world!", "identity;q=0", "SCRIPT_NAME" => "/foo", "PATH_INFO" => "/bar")
- response2[0].should.equal(406)
- response2[1].should.equal({"Content-Type" => "text/plain", "Content-Length" => "78"})
- response2[2].should.equal(["An acceptable encoding for the requested resource /foo/bar could not be found."])
- end
-
- specify "should handle gzip response with Last-Modified header" do
- last_modified = Time.now.httpdate
-
- app = lambda { |env| [200, { "Last-Modified" => last_modified }, ["Hello World!"]] }
- request = Rack::MockRequest.env_for("", "HTTP_ACCEPT_ENCODING" => "gzip")
- response = Rack::Deflater.new(app).call(request)
-
- response[0].should.equal(200)
- response[1].should.equal({
- "Content-Encoding" => "gzip",
- "Vary" => "Accept-Encoding",
- "Last-Modified" => last_modified
- })
-
- buf = ''
- response[2].each { |part| buf << part }
- io = StringIO.new(buf)
- gz = Zlib::GzipReader.new(io)
- gz.read.should.equal("Hello World!")
- gz.close
- end
-
- specify "should do nothing when no-transform Cache-Control directive present" do
- app = lambda { |env| [200, {'Cache-Control' => 'no-transform'}, ['Hello World!']] }
- request = Rack::MockRequest.env_for("", "HTTP_ACCEPT_ENCODING" => "gzip")
- response = Rack::Deflater.new(app).call(request)
-
- response[0].should.equal(200)
- response[1].should.not.include "Content-Encoding"
- response[2].join.should.equal("Hello World!")
- end
-end
diff --git a/vendor/gems/rack-1.1.0/test/spec_rack_directory.rb b/vendor/gems/rack-1.1.0/test/spec_rack_directory.rb
deleted file mode 100644
index d255c91d..00000000
--- a/vendor/gems/rack-1.1.0/test/spec_rack_directory.rb
+++ /dev/null
@@ -1,61 +0,0 @@
-require 'test/spec'
-
-require 'rack/directory'
-require 'rack/lint'
-
-require 'rack/mock'
-
-context "Rack::Directory" do
- DOCROOT = File.expand_path(File.dirname(__FILE__)) unless defined? DOCROOT
- FILE_CATCH = proc{|env| [200, {'Content-Type'=>'text/plain', "Content-Length" => "7"}, ['passed!']] }
- app = Rack::Directory.new DOCROOT, FILE_CATCH
-
- specify "serves directory indices" do
- res = Rack::MockRequest.new(Rack::Lint.new(app)).
- get("/cgi/")
-
- res.should.be.ok
- res.should =~ //
- end
-
- specify "passes to app if file found" do
- res = Rack::MockRequest.new(Rack::Lint.new(app)).
- get("/cgi/test")
-
- res.should.be.ok
- res.should =~ /passed!/
- end
-
- specify "serves uri with URL encoded filenames" do
- res = Rack::MockRequest.new(Rack::Lint.new(app)).
- get("/%63%67%69/") # "/cgi/test"
-
- res.should.be.ok
- res.should =~ //
-
- res = Rack::MockRequest.new(Rack::Lint.new(app)).
- get("/cgi/%74%65%73%74") # "/cgi/test"
-
- res.should.be.ok
- res.should =~ /passed!/
- end
-
- specify "does not allow directory traversal" do
- res = Rack::MockRequest.new(Rack::Lint.new(app)).
- get("/cgi/../test")
-
- res.should.be.forbidden
-
- res = Rack::MockRequest.new(Rack::Lint.new(app)).
- get("/cgi/%2E%2E/test")
-
- res.should.be.forbidden
- end
-
- specify "404s if it can't find the file" do
- res = Rack::MockRequest.new(Rack::Lint.new(app)).
- get("/cgi/blubb")
-
- res.should.be.not_found
- end
-end
diff --git a/vendor/gems/rack-1.1.0/test/spec_rack_etag.rb b/vendor/gems/rack-1.1.0/test/spec_rack_etag.rb
deleted file mode 100644
index 73cd31ac..00000000
--- a/vendor/gems/rack-1.1.0/test/spec_rack_etag.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-require 'test/spec'
-require 'rack/mock'
-require 'rack/etag'
-
-context "Rack::ETag" do
- specify "sets ETag if none is set" do
- app = lambda { |env| [200, {'Content-Type' => 'text/plain'}, ["Hello, World!"]] }
- response = Rack::ETag.new(app).call({})
- response[1]['ETag'].should.equal "\"65a8e27d8879283831b664bd8b7f0ad4\""
- end
-
- specify "does not change ETag if it is already set" do
- app = lambda { |env| [200, {'Content-Type' => 'text/plain', 'ETag' => '"abc"'}, ["Hello, World!"]] }
- response = Rack::ETag.new(app).call({})
- response[1]['ETag'].should.equal "\"abc\""
- end
-end
diff --git a/vendor/gems/rack-1.1.0/test/spec_rack_fastcgi.rb b/vendor/gems/rack-1.1.0/test/spec_rack_fastcgi.rb
deleted file mode 100644
index 1ae55ace..00000000
--- a/vendor/gems/rack-1.1.0/test/spec_rack_fastcgi.rb
+++ /dev/null
@@ -1,89 +0,0 @@
-require 'test/spec'
-require 'testrequest'
-
-context "Rack::Handler::FastCGI" do
- include TestRequest::Helpers
-
- setup do
- @host = '0.0.0.0'
- @port = 9203
- end
-
- # Keep this first.
- specify "startup" do
- $pid = fork {
- Dir.chdir(File.join(File.dirname(__FILE__), "..", "test", "cgi"))
- exec "lighttpd -D -f lighttpd.conf"
- }
- end
-
- specify "should respond" do
- sleep 1
- lambda {
- GET("/test.fcgi")
- }.should.not.raise
- end
-
- specify "should be a lighttpd" do
- GET("/test.fcgi")
- status.should.be 200
- response["SERVER_SOFTWARE"].should =~ /lighttpd/
- response["HTTP_VERSION"].should.equal "HTTP/1.1"
- response["SERVER_PROTOCOL"].should.equal "HTTP/1.1"
- response["SERVER_PORT"].should.equal @port.to_s
- response["SERVER_NAME"].should =~ @host
- end
-
- specify "should have rack headers" do
- GET("/test.fcgi")
- response["rack.version"].should.equal [1,1]
- response["rack.multithread"].should.be false
- response["rack.multiprocess"].should.be true
- response["rack.run_once"].should.be false
- end
-
- specify "should have CGI headers on GET" do
- GET("/test.fcgi")
- response["REQUEST_METHOD"].should.equal "GET"
- response["SCRIPT_NAME"].should.equal "/test.fcgi"
- response["REQUEST_PATH"].should.equal "/"
- response["PATH_INFO"].should.equal ""
- response["QUERY_STRING"].should.equal ""
- response["test.postdata"].should.equal ""
-
- GET("/test.fcgi/foo?quux=1")
- response["REQUEST_METHOD"].should.equal "GET"
- response["SCRIPT_NAME"].should.equal "/test.fcgi"
- response["REQUEST_PATH"].should.equal "/"
- response["PATH_INFO"].should.equal "/foo"
- response["QUERY_STRING"].should.equal "quux=1"
- end
-
- specify "should have CGI headers on POST" do
- POST("/test.fcgi", {"rack-form-data" => "23"}, {'X-test-header' => '42'})
- status.should.equal 200
- response["REQUEST_METHOD"].should.equal "POST"
- response["SCRIPT_NAME"].should.equal "/test.fcgi"
- response["REQUEST_PATH"].should.equal "/"
- response["QUERY_STRING"].should.equal ""
- response["HTTP_X_TEST_HEADER"].should.equal "42"
- response["test.postdata"].should.equal "rack-form-data=23"
- end
-
- specify "should support HTTP auth" do
- GET("/test.fcgi", {:user => "ruth", :passwd => "secret"})
- response["HTTP_AUTHORIZATION"].should.equal "Basic cnV0aDpzZWNyZXQ="
- end
-
- specify "should set status" do
- GET("/test.fcgi?secret")
- status.should.equal 403
- response["rack.url_scheme"].should.equal "http"
- end
-
- # Keep this last.
- specify "shutdown" do
- Process.kill 15, $pid
- Process.wait($pid).should.equal $pid
- end
-end
diff --git a/vendor/gems/rack-1.1.0/test/spec_rack_file.rb b/vendor/gems/rack-1.1.0/test/spec_rack_file.rb
deleted file mode 100644
index 0a2f8ee8..00000000
--- a/vendor/gems/rack-1.1.0/test/spec_rack_file.rb
+++ /dev/null
@@ -1,75 +0,0 @@
-require 'test/spec'
-
-require 'rack/file'
-require 'rack/lint'
-
-require 'rack/mock'
-
-context "Rack::File" do
- DOCROOT = File.expand_path(File.dirname(__FILE__)) unless defined? DOCROOT
-
- specify "serves files" do
- res = Rack::MockRequest.new(Rack::Lint.new(Rack::File.new(DOCROOT))).
- get("/cgi/test")
-
- res.should.be.ok
- res.should =~ /ruby/
- end
-
- specify "sets Last-Modified header" do
- res = Rack::MockRequest.new(Rack::Lint.new(Rack::File.new(DOCROOT))).
- get("/cgi/test")
-
- path = File.join(DOCROOT, "/cgi/test")
-
- res.should.be.ok
- res["Last-Modified"].should.equal File.mtime(path).httpdate
- end
-
- specify "serves files with URL encoded filenames" do
- res = Rack::MockRequest.new(Rack::Lint.new(Rack::File.new(DOCROOT))).
- get("/cgi/%74%65%73%74") # "/cgi/test"
-
- res.should.be.ok
- res.should =~ /ruby/
- end
-
- specify "does not allow directory traversal" do
- res = Rack::MockRequest.new(Rack::Lint.new(Rack::File.new(DOCROOT))).
- get("/cgi/../test")
-
- res.should.be.forbidden
- end
-
- specify "does not allow directory traversal with encoded periods" do
- res = Rack::MockRequest.new(Rack::Lint.new(Rack::File.new(DOCROOT))).
- get("/%2E%2E/README")
-
- res.should.be.forbidden
- end
-
- specify "404s if it can't find the file" do
- res = Rack::MockRequest.new(Rack::Lint.new(Rack::File.new(DOCROOT))).
- get("/cgi/blubb")
-
- res.should.be.not_found
- end
-
- specify "detects SystemCallErrors" do
- res = Rack::MockRequest.new(Rack::Lint.new(Rack::File.new(DOCROOT))).
- get("/cgi")
-
- res.should.be.not_found
- end
-
- specify "returns bodies that respond to #to_path" do
- env = Rack::MockRequest.env_for("/cgi/test")
- status, headers, body = Rack::File.new(DOCROOT).call(env)
-
- path = File.join(DOCROOT, "/cgi/test")
-
- status.should.equal 200
- body.should.respond_to :to_path
- body.to_path.should.equal path
- end
-end
diff --git a/vendor/gems/rack-1.1.0/test/spec_rack_handler.rb b/vendor/gems/rack-1.1.0/test/spec_rack_handler.rb
deleted file mode 100644
index fcf19b78..00000000
--- a/vendor/gems/rack-1.1.0/test/spec_rack_handler.rb
+++ /dev/null
@@ -1,43 +0,0 @@
-require 'test/spec'
-
-require 'rack/handler'
-
-class Rack::Handler::Lobster; end
-class RockLobster; end
-
-context "Rack::Handler" do
- specify "has registered default handlers" do
- Rack::Handler.get('cgi').should.equal Rack::Handler::CGI
- Rack::Handler.get('fastcgi').should.equal Rack::Handler::FastCGI
- Rack::Handler.get('mongrel').should.equal Rack::Handler::Mongrel
- Rack::Handler.get('webrick').should.equal Rack::Handler::WEBrick
- end
-
- specify "handler that doesn't exist should raise a NameError" do
- lambda {
- Rack::Handler.get('boom')
- }.should.raise(NameError)
- end
-
- specify "should get unregistered, but already required, handler by name" do
- Rack::Handler.get('Lobster').should.equal Rack::Handler::Lobster
- end
-
- specify "should register custom handler" do
- Rack::Handler.register('rock_lobster', 'RockLobster')
- Rack::Handler.get('rock_lobster').should.equal RockLobster
- end
-
- specify "should not need registration for properly coded handlers even if not already required" do
- begin
- $:.push "test/unregistered_handler"
- Rack::Handler.get('Unregistered').should.equal Rack::Handler::Unregistered
- lambda {
- Rack::Handler.get('UnRegistered')
- }.should.raise(NameError)
- Rack::Handler.get('UnregisteredLongOne').should.equal Rack::Handler::UnregisteredLongOne
- ensure
- $:.delete "test/unregistered_handler"
- end
- end
-end
diff --git a/vendor/gems/rack-1.1.0/test/spec_rack_head.rb b/vendor/gems/rack-1.1.0/test/spec_rack_head.rb
deleted file mode 100644
index 48d3f81f..00000000
--- a/vendor/gems/rack-1.1.0/test/spec_rack_head.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-require 'rack/head'
-require 'rack/mock'
-
-context "Rack::Head" do
- def test_response(headers = {})
- app = lambda { |env| [200, {"Content-type" => "test/plain", "Content-length" => "3"}, ["foo"]] }
- request = Rack::MockRequest.env_for("/", headers)
- response = Rack::Head.new(app).call(request)
-
- return response
- end
-
- specify "passes GET, POST, PUT, DELETE, OPTIONS, TRACE requests" do
- %w[GET POST PUT DELETE OPTIONS TRACE].each do |type|
- resp = test_response("REQUEST_METHOD" => type)
-
- resp[0].should.equal(200)
- resp[1].should.equal({"Content-type" => "test/plain", "Content-length" => "3"})
- resp[2].should.equal(["foo"])
- end
- end
-
- specify "removes body from HEAD requests" do
- resp = test_response("REQUEST_METHOD" => "HEAD")
-
- resp[0].should.equal(200)
- resp[1].should.equal({"Content-type" => "test/plain", "Content-length" => "3"})
- resp[2].should.equal([])
- end
-end
diff --git a/vendor/gems/rack-1.1.0/test/spec_rack_lint.rb b/vendor/gems/rack-1.1.0/test/spec_rack_lint.rb
deleted file mode 100644
index bbf75c17..00000000
--- a/vendor/gems/rack-1.1.0/test/spec_rack_lint.rb
+++ /dev/null
@@ -1,528 +0,0 @@
-require 'test/spec'
-require 'stringio'
-
-require 'rack/lint'
-require 'rack/mock'
-
-context "Rack::Lint" do
- def env(*args)
- Rack::MockRequest.env_for("/", *args)
- end
-
- specify "passes valid request" do
- lambda {
- Rack::Lint.new(lambda { |env|
- [200, {"Content-type" => "test/plain", "Content-length" => "3"}, ["foo"]]
- }).call(env({}))
- }.should.not.raise
- end
-
- specify "notices fatal errors" do
- lambda { Rack::Lint.new(nil).call }.should.raise(Rack::Lint::LintError).
- message.should.match(/No env given/)
- end
-
- specify "notices environment errors" do
- lambda { Rack::Lint.new(nil).call 5 }.should.raise(Rack::Lint::LintError).
- message.should.match(/not a Hash/)
-
- lambda {
- e = env
- e.delete("REQUEST_METHOD")
- Rack::Lint.new(nil).call(e)
- }.should.raise(Rack::Lint::LintError).
- message.should.match(/missing required key REQUEST_METHOD/)
-
- lambda {
- e = env
- e.delete("SERVER_NAME")
- Rack::Lint.new(nil).call(e)
- }.should.raise(Rack::Lint::LintError).
- message.should.match(/missing required key SERVER_NAME/)
-
-
- lambda {
- Rack::Lint.new(nil).call(env("HTTP_CONTENT_TYPE" => "text/plain"))
- }.should.raise(Rack::Lint::LintError).
- message.should.match(/contains HTTP_CONTENT_TYPE/)
-
- lambda {
- Rack::Lint.new(nil).call(env("HTTP_CONTENT_LENGTH" => "42"))
- }.should.raise(Rack::Lint::LintError).
- message.should.match(/contains HTTP_CONTENT_LENGTH/)
-
- lambda {
- Rack::Lint.new(nil).call(env("FOO" => Object.new))
- }.should.raise(Rack::Lint::LintError).
- message.should.match(/non-string value/)
-
- lambda {
- Rack::Lint.new(nil).call(env("rack.version" => "0.2"))
- }.should.raise(Rack::Lint::LintError).
- message.should.match(/must be an Array/)
-
- lambda {
- Rack::Lint.new(nil).call(env("rack.url_scheme" => "gopher"))
- }.should.raise(Rack::Lint::LintError).
- message.should.match(/url_scheme unknown/)
-
- lambda {
- Rack::Lint.new(nil).call(env("rack.session" => []))
- }.should.raise(Rack::Lint::LintError).
- message.should.equal("session [] must respond to store and []=")
-
- lambda {
- Rack::Lint.new(nil).call(env("rack.logger" => []))
- }.should.raise(Rack::Lint::LintError).
- message.should.equal("logger [] must respond to info")
-
- lambda {
- Rack::Lint.new(nil).call(env("REQUEST_METHOD" => "FUCKUP?"))
- }.should.raise(Rack::Lint::LintError).
- message.should.match(/REQUEST_METHOD/)
-
- lambda {
- Rack::Lint.new(nil).call(env("SCRIPT_NAME" => "howdy"))
- }.should.raise(Rack::Lint::LintError).
- message.should.match(/must start with/)
-
- lambda {
- Rack::Lint.new(nil).call(env("PATH_INFO" => "../foo"))
- }.should.raise(Rack::Lint::LintError).
- message.should.match(/must start with/)
-
- lambda {
- Rack::Lint.new(nil).call(env("CONTENT_LENGTH" => "xcii"))
- }.should.raise(Rack::Lint::LintError).
- message.should.match(/Invalid CONTENT_LENGTH/)
-
- lambda {
- e = env
- e.delete("PATH_INFO")
- e.delete("SCRIPT_NAME")
- Rack::Lint.new(nil).call(e)
- }.should.raise(Rack::Lint::LintError).
- message.should.match(/One of .* must be set/)
-
- lambda {
- Rack::Lint.new(nil).call(env("SCRIPT_NAME" => "/"))
- }.should.raise(Rack::Lint::LintError).
- message.should.match(/cannot be .* make it ''/)
- end
-
- specify "notices input errors" do
- lambda {
- Rack::Lint.new(nil).call(env("rack.input" => ""))
- }.should.raise(Rack::Lint::LintError).
- message.should.match(/does not respond to #gets/)
-
- lambda {
- input = Object.new
- def input.binmode?
- false
- end
- Rack::Lint.new(nil).call(env("rack.input" => input))
- }.should.raise(Rack::Lint::LintError).
- message.should.match(/is not opened in binary mode/)
-
- lambda {
- input = Object.new
- def input.external_encoding
- result = Object.new
- def result.name
- "US-ASCII"
- end
- result
- end
- Rack::Lint.new(nil).call(env("rack.input" => input))
- }.should.raise(Rack::Lint::LintError).
- message.should.match(/does not have ASCII-8BIT as its external encoding/)
- end
-
- specify "notices error errors" do
- lambda {
- Rack::Lint.new(nil).call(env("rack.errors" => ""))
- }.should.raise(Rack::Lint::LintError).
- message.should.match(/does not respond to #puts/)
- end
-
- specify "notices status errors" do
- lambda {
- Rack::Lint.new(lambda { |env|
- ["cc", {}, ""]
- }).call(env({}))
- }.should.raise(Rack::Lint::LintError).
- message.should.match(/must be >=100 seen as integer/)
-
- lambda {
- Rack::Lint.new(lambda { |env|
- [42, {}, ""]
- }).call(env({}))
- }.should.raise(Rack::Lint::LintError).
- message.should.match(/must be >=100 seen as integer/)
- end
-
- specify "notices header errors" do
- lambda {
- Rack::Lint.new(lambda { |env|
- [200, Object.new, []]
- }).call(env({}))
- }.should.raise(Rack::Lint::LintError).
- message.should.equal("headers object should respond to #each, but doesn't (got Object as headers)")
-
- lambda {
- Rack::Lint.new(lambda { |env|
- [200, {true=>false}, []]
- }).call(env({}))
- }.should.raise(Rack::Lint::LintError).
- message.should.equal("header key must be a string, was TrueClass")
-
- lambda {
- Rack::Lint.new(lambda { |env|
- [200, {"Status" => "404"}, []]
- }).call(env({}))
- }.should.raise(Rack::Lint::LintError).
- message.should.match(/must not contain Status/)
-
- lambda {
- Rack::Lint.new(lambda { |env|
- [200, {"Content-Type:" => "text/plain"}, []]
- }).call(env({}))
- }.should.raise(Rack::Lint::LintError).
- message.should.match(/must not contain :/)
-
- lambda {
- Rack::Lint.new(lambda { |env|
- [200, {"Content-" => "text/plain"}, []]
- }).call(env({}))
- }.should.raise(Rack::Lint::LintError).
- message.should.match(/must not end/)
-
- lambda {
- Rack::Lint.new(lambda { |env|
- [200, {"..%%quark%%.." => "text/plain"}, []]
- }).call(env({}))
- }.should.raise(Rack::Lint::LintError).
- message.should.equal("invalid header name: ..%%quark%%..")
-
- lambda {
- Rack::Lint.new(lambda { |env|
- [200, {"Foo" => Object.new}, []]
- }).call(env({}))
- }.should.raise(Rack::Lint::LintError).
- message.should.equal("a header value must be a String, but the value of 'Foo' is a Object")
-
- lambda {
- Rack::Lint.new(lambda { |env|
- [200, {"Foo" => [1, 2, 3]}, []]
- }).call(env({}))
- }.should.raise(Rack::Lint::LintError).
- message.should.equal("a header value must be a String, but the value of 'Foo' is a Array")
-
-
- lambda {
- Rack::Lint.new(lambda { |env|
- [200, {"Foo-Bar" => "text\000plain"}, []]
- }).call(env({}))
- }.should.raise(Rack::Lint::LintError).
- message.should.match(/invalid header/)
-
- # line ends (010) should be allowed in header values.
- lambda {
- Rack::Lint.new(lambda { |env|
- [200, {"Foo-Bar" => "one\ntwo\nthree", "Content-Length" => "0", "Content-Type" => "text/plain" }, []]
- }).call(env({}))
- }.should.not.raise(Rack::Lint::LintError)
- end
-
- specify "notices content-type errors" do
- lambda {
- Rack::Lint.new(lambda { |env|
- [200, {"Content-length" => "0"}, []]
- }).call(env({}))
- }.should.raise(Rack::Lint::LintError).
- message.should.match(/No Content-Type/)
-
- [100, 101, 204, 304].each do |status|
- lambda {
- Rack::Lint.new(lambda { |env|
- [status, {"Content-type" => "text/plain", "Content-length" => "0"}, []]
- }).call(env({}))
- }.should.raise(Rack::Lint::LintError).
- message.should.match(/Content-Type header found/)
- end
- end
-
- specify "notices content-length errors" do
- [100, 101, 204, 304].each do |status|
- lambda {
- Rack::Lint.new(lambda { |env|
- [status, {"Content-length" => "0"}, []]
- }).call(env({}))
- }.should.raise(Rack::Lint::LintError).
- message.should.match(/Content-Length header found/)
- end
-
- lambda {
- Rack::Lint.new(lambda { |env|
- [200, {"Content-type" => "text/plain", "Content-Length" => "1"}, []]
- }).call(env({}))
- }.should.raise(Rack::Lint::LintError).
- message.should.match(/Content-Length header was 1, but should be 0/)
- end
-
- specify "notices body errors" do
- lambda {
- status, header, body = Rack::Lint.new(lambda { |env|
- [200, {"Content-type" => "text/plain","Content-length" => "3"}, [1,2,3]]
- }).call(env({}))
- body.each { |part| }
- }.should.raise(Rack::Lint::LintError).
- message.should.match(/yielded non-string/)
- end
-
- specify "notices input handling errors" do
- lambda {
- Rack::Lint.new(lambda { |env|
- env["rack.input"].gets("\r\n")
- [201, {"Content-type" => "text/plain", "Content-length" => "0"}, []]
- }).call(env({}))
- }.should.raise(Rack::Lint::LintError).
- message.should.match(/gets called with arguments/)
-
- lambda {
- Rack::Lint.new(lambda { |env|
- env["rack.input"].read(1, 2, 3)
- [201, {"Content-type" => "text/plain", "Content-length" => "0"}, []]
- }).call(env({}))
- }.should.raise(Rack::Lint::LintError).
- message.should.match(/read called with too many arguments/)
-
- lambda {
- Rack::Lint.new(lambda { |env|
- env["rack.input"].read("foo")
- [201, {"Content-type" => "text/plain", "Content-length" => "0"}, []]
- }).call(env({}))
- }.should.raise(Rack::Lint::LintError).
- message.should.match(/read called with non-integer and non-nil length/)
-
- lambda {
- Rack::Lint.new(lambda { |env|
- env["rack.input"].read(-1)
- [201, {"Content-type" => "text/plain", "Content-length" => "0"}, []]
- }).call(env({}))
- }.should.raise(Rack::Lint::LintError).
- message.should.match(/read called with a negative length/)
-
- lambda {
- Rack::Lint.new(lambda { |env|
- env["rack.input"].read(nil, nil)
- [201, {"Content-type" => "text/plain", "Content-length" => "0"}, []]
- }).call(env({}))
- }.should.raise(Rack::Lint::LintError).
- message.should.match(/read called with non-String buffer/)
-
- lambda {
- Rack::Lint.new(lambda { |env|
- env["rack.input"].read(nil, 1)
- [201, {"Content-type" => "text/plain", "Content-length" => "0"}, []]
- }).call(env({}))
- }.should.raise(Rack::Lint::LintError).
- message.should.match(/read called with non-String buffer/)
-
- lambda {
- Rack::Lint.new(lambda { |env|
- env["rack.input"].rewind(0)
- [201, {"Content-type" => "text/plain", "Content-length" => "0"}, []]
- }).call(env({}))
- }.should.raise(Rack::Lint::LintError).
- message.should.match(/rewind called with arguments/)
-
- weirdio = Object.new
- class << weirdio
- def gets
- 42
- end
-
- def read
- 23
- end
-
- def each
- yield 23
- yield 42
- end
-
- def rewind
- raise Errno::ESPIPE, "Errno::ESPIPE"
- end
- end
-
- eof_weirdio = Object.new
- class << eof_weirdio
- def gets
- nil
- end
-
- def read(*args)
- nil
- end
-
- def each
- end
-
- def rewind
- end
- end
-
- lambda {
- Rack::Lint.new(lambda { |env|
- env["rack.input"].gets
- [201, {"Content-type" => "text/plain", "Content-length" => "0"}, []]
- }).call(env("rack.input" => weirdio))
- }.should.raise(Rack::Lint::LintError).
- message.should.match(/gets didn't return a String/)
-
- lambda {
- Rack::Lint.new(lambda { |env|
- env["rack.input"].each { |x| }
- [201, {"Content-type" => "text/plain", "Content-length" => "0"}, []]
- }).call(env("rack.input" => weirdio))
- }.should.raise(Rack::Lint::LintError).
- message.should.match(/each didn't yield a String/)
-
- lambda {
- Rack::Lint.new(lambda { |env|
- env["rack.input"].read
- [201, {"Content-type" => "text/plain", "Content-length" => "0"}, []]
- }).call(env("rack.input" => weirdio))
- }.should.raise(Rack::Lint::LintError).
- message.should.match(/read didn't return nil or a String/)
-
- lambda {
- Rack::Lint.new(lambda { |env|
- env["rack.input"].read
- [201, {"Content-type" => "text/plain", "Content-length" => "0"}, []]
- }).call(env("rack.input" => eof_weirdio))
- }.should.raise(Rack::Lint::LintError).
- message.should.match(/read\(nil\) returned nil on EOF/)
-
- lambda {
- Rack::Lint.new(lambda { |env|
- env["rack.input"].rewind
- [201, {"Content-type" => "text/plain", "Content-length" => "0"}, []]
- }).call(env("rack.input" => weirdio))
- }.should.raise(Rack::Lint::LintError).
- message.should.match(/rewind raised Errno::ESPIPE/)
-
-
- lambda {
- Rack::Lint.new(lambda { |env|
- env["rack.input"].close
- [201, {"Content-type" => "text/plain", "Content-length" => "0"}, []]
- }).call(env({}))
- }.should.raise(Rack::Lint::LintError).
- message.should.match(/close must not be called/)
- end
-
- specify "notices error handling errors" do
- lambda {
- Rack::Lint.new(lambda { |env|
- env["rack.errors"].write(42)
- [201, {"Content-type" => "text/plain", "Content-length" => "0"}, []]
- }).call(env({}))
- }.should.raise(Rack::Lint::LintError).
- message.should.match(/write not called with a String/)
-
- lambda {
- Rack::Lint.new(lambda { |env|
- env["rack.errors"].close
- [201, {"Content-type" => "text/plain", "Content-length" => "0"}, []]
- }).call(env({}))
- }.should.raise(Rack::Lint::LintError).
- message.should.match(/close must not be called/)
- end
-
- specify "notices HEAD errors" do
- lambda {
- Rack::Lint.new(lambda { |env|
- [200, {"Content-type" => "test/plain", "Content-length" => "3"}, []]
- }).call(env({"REQUEST_METHOD" => "HEAD"}))
- }.should.not.raise
-
- lambda {
- Rack::Lint.new(lambda { |env|
- [200, {"Content-type" => "test/plain", "Content-length" => "3"}, ["foo"]]
- }).call(env({"REQUEST_METHOD" => "HEAD"}))
- }.should.raise(Rack::Lint::LintError).
- message.should.match(/body was given for HEAD/)
- end
-
- specify "passes valid read calls" do
- hello_str = "hello world"
- hello_str.force_encoding("ASCII-8BIT") if hello_str.respond_to? :force_encoding
- lambda {
- Rack::Lint.new(lambda { |env|
- env["rack.input"].read
- [201, {"Content-type" => "text/plain", "Content-length" => "0"}, []]
- }).call(env({"rack.input" => StringIO.new(hello_str)}))
- }.should.not.raise(Rack::Lint::LintError)
-
- lambda {
- Rack::Lint.new(lambda { |env|
- env["rack.input"].read(0)
- [201, {"Content-type" => "text/plain", "Content-length" => "0"}, []]
- }).call(env({"rack.input" => StringIO.new(hello_str)}))
- }.should.not.raise(Rack::Lint::LintError)
-
- lambda {
- Rack::Lint.new(lambda { |env|
- env["rack.input"].read(1)
- [201, {"Content-type" => "text/plain", "Content-length" => "0"}, []]
- }).call(env({"rack.input" => StringIO.new(hello_str)}))
- }.should.not.raise(Rack::Lint::LintError)
-
- lambda {
- Rack::Lint.new(lambda { |env|
- env["rack.input"].read(nil)
- [201, {"Content-type" => "text/plain", "Content-length" => "0"}, []]
- }).call(env({"rack.input" => StringIO.new(hello_str)}))
- }.should.not.raise(Rack::Lint::LintError)
-
- lambda {
- Rack::Lint.new(lambda { |env|
- env["rack.input"].read(nil, '')
- [201, {"Content-type" => "text/plain", "Content-length" => "0"}, []]
- }).call(env({"rack.input" => StringIO.new(hello_str)}))
- }.should.not.raise(Rack::Lint::LintError)
-
- lambda {
- Rack::Lint.new(lambda { |env|
- env["rack.input"].read(1, '')
- [201, {"Content-type" => "text/plain", "Content-length" => "0"}, []]
- }).call(env({"rack.input" => StringIO.new(hello_str)}))
- }.should.not.raise(Rack::Lint::LintError)
- end
-end
-
-context "Rack::Lint::InputWrapper" do
- specify "delegates :size to underlying IO object" do
- class IOMock
- def size
- 101
- end
- end
-
- wrapper = Rack::Lint::InputWrapper.new(IOMock.new)
- wrapper.size.should == 101
- end
-
- specify "delegates :rewind to underlying IO object" do
- io = StringIO.new("123")
- wrapper = Rack::Lint::InputWrapper.new(io)
- wrapper.read.should.equal "123"
- wrapper.read.should.equal ""
- wrapper.rewind
- wrapper.read.should.equal "123"
- end
-end
diff --git a/vendor/gems/rack-1.1.0/test/spec_rack_lobster.rb b/vendor/gems/rack-1.1.0/test/spec_rack_lobster.rb
deleted file mode 100644
index 7be267a2..00000000
--- a/vendor/gems/rack-1.1.0/test/spec_rack_lobster.rb
+++ /dev/null
@@ -1,45 +0,0 @@
-require 'test/spec'
-
-require 'rack/lobster'
-require 'rack/mock'
-
-context "Rack::Lobster::LambdaLobster" do
- specify "should be a single lambda" do
- Rack::Lobster::LambdaLobster.should.be.kind_of Proc
- end
-
- specify "should look like a lobster" do
- res = Rack::MockRequest.new(Rack::Lobster::LambdaLobster).get("/")
- res.should.be.ok
- res.body.should.include "(,(,,(,,,("
- res.body.should.include "?flip"
- end
-
- specify "should be flippable" do
- res = Rack::MockRequest.new(Rack::Lobster::LambdaLobster).get("/?flip")
- res.should.be.ok
- res.body.should.include "(,,,(,,(,("
- end
-end
-
-context "Rack::Lobster" do
- specify "should look like a lobster" do
- res = Rack::MockRequest.new(Rack::Lobster.new).get("/")
- res.should.be.ok
- res.body.should.include "(,(,,(,,,("
- res.body.should.include "?flip"
- res.body.should.include "crash"
- end
-
- specify "should be flippable" do
- res = Rack::MockRequest.new(Rack::Lobster.new).get("/?flip=left")
- res.should.be.ok
- res.body.should.include "(,,,(,,(,("
- end
-
- specify "should provide crashing for testing purposes" do
- lambda {
- Rack::MockRequest.new(Rack::Lobster.new).get("/?flip=crash")
- }.should.raise
- end
-end
diff --git a/vendor/gems/rack-1.1.0/test/spec_rack_lock.rb b/vendor/gems/rack-1.1.0/test/spec_rack_lock.rb
deleted file mode 100644
index 18af2b23..00000000
--- a/vendor/gems/rack-1.1.0/test/spec_rack_lock.rb
+++ /dev/null
@@ -1,38 +0,0 @@
-require 'test/spec'
-
-require 'rack/mock'
-require 'rack/lock'
-
-context "Rack::Lock" do
- class Lock
- attr_reader :synchronized
-
- def initialize
- @synchronized = false
- end
-
- def synchronize
- @synchronized = true
- yield
- end
- end
-
- specify "should call synchronize on lock" do
- lock = Lock.new
- env = Rack::MockRequest.env_for("/")
- app = Rack::Lock.new(lambda { |env| }, lock)
- lock.synchronized.should.equal false
- app.call(env)
- lock.synchronized.should.equal true
- end
-
- specify "should set multithread flag to false" do
- app = Rack::Lock.new(lambda { |env| env['rack.multithread'] })
- app.call(Rack::MockRequest.env_for("/")).should.equal false
- end
-
- specify "should reset original multithread flag when exiting lock" do
- app = Rack::Lock.new(lambda { |env| env })
- app.call(Rack::MockRequest.env_for("/"))['rack.multithread'].should.equal true
- end
-end
diff --git a/vendor/gems/rack-1.1.0/test/spec_rack_logger.rb b/vendor/gems/rack-1.1.0/test/spec_rack_logger.rb
deleted file mode 100644
index d55b9c77..00000000
--- a/vendor/gems/rack-1.1.0/test/spec_rack_logger.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-require 'rack/logger'
-require 'rack/lint'
-require 'stringio'
-
-context "Rack::Logger" do
- specify "logs to rack.errors" do
- app = lambda { |env|
- log = env['rack.logger']
- log.debug("Created logger")
- log.info("Program started")
- log.warn("Nothing to do!")
-
- [200, {'Content-Type' => 'text/plain'}, ["Hello, World!"]]
- }
-
- errors = StringIO.new
- Rack::Logger.new(app).call({'rack.errors' => errors})
- errors.string.should.match "INFO -- : Program started"
- errors.string.should.match "WARN -- : Nothing to do"
- end
-end
diff --git a/vendor/gems/rack-1.1.0/test/spec_rack_methodoverride.rb b/vendor/gems/rack-1.1.0/test/spec_rack_methodoverride.rb
deleted file mode 100644
index 57452394..00000000
--- a/vendor/gems/rack-1.1.0/test/spec_rack_methodoverride.rb
+++ /dev/null
@@ -1,60 +0,0 @@
-require 'test/spec'
-
-require 'rack/mock'
-require 'rack/methodoverride'
-require 'stringio'
-
-context "Rack::MethodOverride" do
- specify "should not affect GET requests" do
- env = Rack::MockRequest.env_for("/?_method=delete", :method => "GET")
- app = Rack::MethodOverride.new(lambda { |env| Rack::Request.new(env) })
- req = app.call(env)
-
- req.env["REQUEST_METHOD"].should.equal "GET"
- end
-
- specify "_method parameter should modify REQUEST_METHOD for POST requests" do
- env = Rack::MockRequest.env_for("/", :method => "POST", :input => "_method=put")
- app = Rack::MethodOverride.new(lambda { |env| Rack::Request.new(env) })
- req = app.call(env)
-
- req.env["REQUEST_METHOD"].should.equal "PUT"
- end
-
- specify "X-HTTP-Method-Override header should modify REQUEST_METHOD for POST requests" do
- env = Rack::MockRequest.env_for("/",
- :method => "POST",
- "HTTP_X_HTTP_METHOD_OVERRIDE" => "PUT"
- )
- app = Rack::MethodOverride.new(lambda { |env| Rack::Request.new(env) })
- req = app.call(env)
-
- req.env["REQUEST_METHOD"].should.equal "PUT"
- end
-
- specify "should not modify REQUEST_METHOD if the method is unknown" do
- env = Rack::MockRequest.env_for("/", :method => "POST", :input => "_method=foo")
- app = Rack::MethodOverride.new(lambda { |env| Rack::Request.new(env) })
- req = app.call(env)
-
- req.env["REQUEST_METHOD"].should.equal "POST"
- end
-
- specify "should not modify REQUEST_METHOD when _method is nil" do
- env = Rack::MockRequest.env_for("/", :method => "POST", :input => "foo=bar")
- app = Rack::MethodOverride.new(lambda { |env| Rack::Request.new(env) })
- req = app.call(env)
-
- req.env["REQUEST_METHOD"].should.equal "POST"
- end
-
- specify "should store the original REQUEST_METHOD prior to overriding" do
- env = Rack::MockRequest.env_for("/",
- :method => "POST",
- :input => "_method=options")
- app = Rack::MethodOverride.new(lambda { |env| Rack::Request.new(env) })
- req = app.call(env)
-
- req.env["rack.methodoverride.original_method"].should.equal "POST"
- end
-end
diff --git a/vendor/gems/rack-1.1.0/test/spec_rack_mock.rb b/vendor/gems/rack-1.1.0/test/spec_rack_mock.rb
deleted file mode 100644
index a03bedc2..00000000
--- a/vendor/gems/rack-1.1.0/test/spec_rack_mock.rb
+++ /dev/null
@@ -1,243 +0,0 @@
-require 'yaml'
-require 'rack/mock'
-require 'rack/request'
-require 'rack/response'
-
-app = lambda { |env|
- req = Rack::Request.new(env)
-
- env["mock.postdata"] = env["rack.input"].read
- if req.GET["error"]
- env["rack.errors"].puts req.GET["error"]
- env["rack.errors"].flush
- end
-
- Rack::Response.new(env.to_yaml,
- req.GET["status"] || 200,
- "Content-Type" => "text/yaml").finish
-}
-
-context "Rack::MockRequest" do
- specify "should return a MockResponse" do
- res = Rack::MockRequest.new(app).get("")
- res.should.be.kind_of Rack::MockResponse
- end
-
- specify "should be able to only return the environment" do
- env = Rack::MockRequest.env_for("")
- env.should.be.kind_of Hash
- env.should.include "rack.version"
- end
-
- specify "should provide sensible defaults" do
- res = Rack::MockRequest.new(app).request
-
- env = YAML.load(res.body)
- env["REQUEST_METHOD"].should.equal "GET"
- env["SERVER_NAME"].should.equal "example.org"
- env["SERVER_PORT"].should.equal "80"
- env["QUERY_STRING"].should.equal ""
- env["PATH_INFO"].should.equal "/"
- env["SCRIPT_NAME"].should.equal ""
- env["rack.url_scheme"].should.equal "http"
- env["mock.postdata"].should.be.empty
- end
-
- specify "should allow GET/POST/PUT/DELETE" do
- res = Rack::MockRequest.new(app).get("", :input => "foo")
- env = YAML.load(res.body)
- env["REQUEST_METHOD"].should.equal "GET"
-
- res = Rack::MockRequest.new(app).post("", :input => "foo")
- env = YAML.load(res.body)
- env["REQUEST_METHOD"].should.equal "POST"
-
- res = Rack::MockRequest.new(app).put("", :input => "foo")
- env = YAML.load(res.body)
- env["REQUEST_METHOD"].should.equal "PUT"
-
- res = Rack::MockRequest.new(app).delete("", :input => "foo")
- env = YAML.load(res.body)
- env["REQUEST_METHOD"].should.equal "DELETE"
-
- Rack::MockRequest.env_for("/", :method => "OPTIONS")["REQUEST_METHOD"].
- should.equal "OPTIONS"
- end
-
- specify "should set content length" do
- env = Rack::MockRequest.env_for("/", :input => "foo")
- env["CONTENT_LENGTH"].should.equal "3"
- end
-
- specify "should allow posting" do
- res = Rack::MockRequest.new(app).get("", :input => "foo")
- env = YAML.load(res.body)
- env["mock.postdata"].should.equal "foo"
-
- res = Rack::MockRequest.new(app).post("", :input => StringIO.new("foo"))
- env = YAML.load(res.body)
- env["mock.postdata"].should.equal "foo"
- end
-
- specify "should use all parts of an URL" do
- res = Rack::MockRequest.new(app).
- get("https://bla.example.org:9292/meh/foo?bar")
- res.should.be.kind_of Rack::MockResponse
-
- env = YAML.load(res.body)
- env["REQUEST_METHOD"].should.equal "GET"
- env["SERVER_NAME"].should.equal "bla.example.org"
- env["SERVER_PORT"].should.equal "9292"
- env["QUERY_STRING"].should.equal "bar"
- env["PATH_INFO"].should.equal "/meh/foo"
- env["rack.url_scheme"].should.equal "https"
- end
-
- specify "should set SSL port and HTTP flag on when using https" do
- res = Rack::MockRequest.new(app).
- get("https://example.org/foo")
- res.should.be.kind_of Rack::MockResponse
-
- env = YAML.load(res.body)
- env["REQUEST_METHOD"].should.equal "GET"
- env["SERVER_NAME"].should.equal "example.org"
- env["SERVER_PORT"].should.equal "443"
- env["QUERY_STRING"].should.equal ""
- env["PATH_INFO"].should.equal "/foo"
- env["rack.url_scheme"].should.equal "https"
- env["HTTPS"].should.equal "on"
- end
-
- specify "should prepend slash to uri path" do
- res = Rack::MockRequest.new(app).
- get("foo")
- res.should.be.kind_of Rack::MockResponse
-
- env = YAML.load(res.body)
- env["REQUEST_METHOD"].should.equal "GET"
- env["SERVER_NAME"].should.equal "example.org"
- env["SERVER_PORT"].should.equal "80"
- env["QUERY_STRING"].should.equal ""
- env["PATH_INFO"].should.equal "/foo"
- env["rack.url_scheme"].should.equal "http"
- end
-
- specify "should properly convert method name to an uppercase string" do
- res = Rack::MockRequest.new(app).request(:get)
- env = YAML.load(res.body)
- env["REQUEST_METHOD"].should.equal "GET"
- end
-
- specify "should accept params and build query string for GET requests" do
- res = Rack::MockRequest.new(app).get("/foo?baz=2", :params => {:foo => {:bar => "1"}})
- env = YAML.load(res.body)
- env["REQUEST_METHOD"].should.equal "GET"
- env["QUERY_STRING"].should.match "baz=2"
- env["QUERY_STRING"].should.match "foo[bar]=1"
- env["PATH_INFO"].should.equal "/foo"
- env["mock.postdata"].should.equal ""
- end
-
- specify "should accept raw input in params for GET requests" do
- res = Rack::MockRequest.new(app).get("/foo?baz=2", :params => "foo[bar]=1")
- env = YAML.load(res.body)
- env["REQUEST_METHOD"].should.equal "GET"
- env["QUERY_STRING"].should.match "baz=2"
- env["QUERY_STRING"].should.match "foo[bar]=1"
- env["PATH_INFO"].should.equal "/foo"
- env["mock.postdata"].should.equal ""
- end
-
- specify "should accept params and build url encoded params for POST requests" do
- res = Rack::MockRequest.new(app).post("/foo", :params => {:foo => {:bar => "1"}})
- env = YAML.load(res.body)
- env["REQUEST_METHOD"].should.equal "POST"
- env["QUERY_STRING"].should.equal ""
- env["PATH_INFO"].should.equal "/foo"
- env["CONTENT_TYPE"].should.equal "application/x-www-form-urlencoded"
- env["mock.postdata"].should.equal "foo[bar]=1"
- end
-
- specify "should accept raw input in params for POST requests" do
- res = Rack::MockRequest.new(app).post("/foo", :params => "foo[bar]=1")
- env = YAML.load(res.body)
- env["REQUEST_METHOD"].should.equal "POST"
- env["QUERY_STRING"].should.equal ""
- env["PATH_INFO"].should.equal "/foo"
- env["CONTENT_TYPE"].should.equal "application/x-www-form-urlencoded"
- env["mock.postdata"].should.equal "foo[bar]=1"
- end
-
- specify "should accept params and build multipart encoded params for POST requests" do
- files = Rack::Utils::Multipart::UploadedFile.new(File.join(File.dirname(__FILE__), "multipart", "file1.txt"))
- res = Rack::MockRequest.new(app).post("/foo", :params => { "submit-name" => "Larry", "files" => files })
- env = YAML.load(res.body)
- env["REQUEST_METHOD"].should.equal "POST"
- env["QUERY_STRING"].should.equal ""
- env["PATH_INFO"].should.equal "/foo"
- env["CONTENT_TYPE"].should.equal "multipart/form-data; boundary=AaB03x"
- env["mock.postdata"].length.should.equal 206
- end
-
- specify "should behave valid according to the Rack spec" do
- lambda {
- res = Rack::MockRequest.new(app).
- get("https://bla.example.org:9292/meh/foo?bar", :lint => true)
- }.should.not.raise(Rack::Lint::LintError)
- end
-end
-
-context "Rack::MockResponse" do
- specify "should provide access to the HTTP status" do
- res = Rack::MockRequest.new(app).get("")
- res.should.be.successful
- res.should.be.ok
-
- res = Rack::MockRequest.new(app).get("/?status=404")
- res.should.not.be.successful
- res.should.be.client_error
- res.should.be.not_found
-
- res = Rack::MockRequest.new(app).get("/?status=501")
- res.should.not.be.successful
- res.should.be.server_error
-
- res = Rack::MockRequest.new(app).get("/?status=307")
- res.should.be.redirect
-
- res = Rack::MockRequest.new(app).get("/?status=201", :lint => true)
- res.should.be.empty
- end
-
- specify "should provide access to the HTTP headers" do
- res = Rack::MockRequest.new(app).get("")
- res.should.include "Content-Type"
- res.headers["Content-Type"].should.equal "text/yaml"
- res.original_headers["Content-Type"].should.equal "text/yaml"
- res["Content-Type"].should.equal "text/yaml"
- res.content_type.should.equal "text/yaml"
- res.content_length.should.be 414 # needs change often.
- res.location.should.be.nil
- end
-
- specify "should provide access to the HTTP body" do
- res = Rack::MockRequest.new(app).get("")
- res.body.should =~ /rack/
- res.should =~ /rack/
- res.should.match(/rack/)
- res.should.satisfy { |r| r.match(/rack/) }
- end
-
- specify "should provide access to the Rack errors" do
- res = Rack::MockRequest.new(app).get("/?error=foo", :lint => true)
- res.should.be.ok
- res.errors.should.not.be.empty
- res.errors.should.include "foo"
- end
-
- specify "should optionally make Rack errors fatal" do
- lambda {
- Rack::MockRequest.new(app).get("/?error=foo", :fatal => true)
- }.should.raise(Rack::MockRequest::FatalWarning)
- end
-end
diff --git a/vendor/gems/rack-1.1.0/test/spec_rack_mongrel.rb b/vendor/gems/rack-1.1.0/test/spec_rack_mongrel.rb
deleted file mode 100644
index 4b386891..00000000
--- a/vendor/gems/rack-1.1.0/test/spec_rack_mongrel.rb
+++ /dev/null
@@ -1,189 +0,0 @@
-require 'test/spec'
-
-begin
-require 'rack/handler/mongrel'
-require 'rack/urlmap'
-require 'rack/lint'
-require 'testrequest'
-require 'timeout'
-
-Thread.abort_on_exception = true
-$tcp_defer_accept_opts = nil
-$tcp_cork_opts = nil
-
-context "Rack::Handler::Mongrel" do
- include TestRequest::Helpers
-
- setup do
- server = Mongrel::HttpServer.new(@host='0.0.0.0', @port=9201)
- server.register('/test',
- Rack::Handler::Mongrel.new(Rack::Lint.new(TestRequest.new)))
- server.register('/stream',
- Rack::Handler::Mongrel.new(Rack::Lint.new(StreamingRequest)))
- @acc = server.run
- end
-
- specify "should respond" do
- lambda {
- GET("/test")
- }.should.not.raise
- end
-
- specify "should be a Mongrel" do
- GET("/test")
- status.should.be 200
- response["SERVER_SOFTWARE"].should =~ /Mongrel/
- response["HTTP_VERSION"].should.equal "HTTP/1.1"
- response["SERVER_PROTOCOL"].should.equal "HTTP/1.1"
- response["SERVER_PORT"].should.equal "9201"
- response["SERVER_NAME"].should.equal "0.0.0.0"
- end
-
- specify "should have rack headers" do
- GET("/test")
- response["rack.version"].should.equal [1,1]
- response["rack.multithread"].should.be true
- response["rack.multiprocess"].should.be false
- response["rack.run_once"].should.be false
- end
-
- specify "should have CGI headers on GET" do
- GET("/test")
- response["REQUEST_METHOD"].should.equal "GET"
- response["SCRIPT_NAME"].should.equal "/test"
- response["REQUEST_PATH"].should.equal "/test"
- response["PATH_INFO"].should.be.equal ""
- response["QUERY_STRING"].should.equal ""
- response["test.postdata"].should.equal ""
-
- GET("/test/foo?quux=1")
- response["REQUEST_METHOD"].should.equal "GET"
- response["SCRIPT_NAME"].should.equal "/test"
- response["REQUEST_PATH"].should.equal "/test/foo"
- response["PATH_INFO"].should.equal "/foo"
- response["QUERY_STRING"].should.equal "quux=1"
- end
-
- specify "should have CGI headers on POST" do
- POST("/test", {"rack-form-data" => "23"}, {'X-test-header' => '42'})
- status.should.equal 200
- response["REQUEST_METHOD"].should.equal "POST"
- response["SCRIPT_NAME"].should.equal "/test"
- response["REQUEST_PATH"].should.equal "/test"
- response["QUERY_STRING"].should.equal ""
- response["HTTP_X_TEST_HEADER"].should.equal "42"
- response["test.postdata"].should.equal "rack-form-data=23"
- end
-
- specify "should support HTTP auth" do
- GET("/test", {:user => "ruth", :passwd => "secret"})
- response["HTTP_AUTHORIZATION"].should.equal "Basic cnV0aDpzZWNyZXQ="
- end
-
- specify "should set status" do
- GET("/test?secret")
- status.should.equal 403
- response["rack.url_scheme"].should.equal "http"
- end
-
- specify "should provide a .run" do
- block_ran = false
- Thread.new {
- Rack::Handler::Mongrel.run(lambda {}, {:Port => 9211}) { |server|
- server.should.be.kind_of Mongrel::HttpServer
- block_ran = true
- }
- }
- sleep 1
- block_ran.should.be true
- end
-
- specify "should provide a .run that maps a hash" do
- block_ran = false
- Thread.new {
- map = {'/'=>lambda{},'/foo'=>lambda{}}
- Rack::Handler::Mongrel.run(map, :map => true, :Port => 9221) { |server|
- server.should.be.kind_of Mongrel::HttpServer
- server.classifier.uris.size.should.be 2
- server.classifier.uris.should.not.include '/arf'
- server.classifier.uris.should.include '/'
- server.classifier.uris.should.include '/foo'
- block_ran = true
- }
- }
- sleep 1
- block_ran.should.be true
- end
-
- specify "should provide a .run that maps a urlmap" do
- block_ran = false
- Thread.new {
- map = Rack::URLMap.new({'/'=>lambda{},'/bar'=>lambda{}})
- Rack::Handler::Mongrel.run(map, {:map => true, :Port => 9231}) { |server|
- server.should.be.kind_of Mongrel::HttpServer
- server.classifier.uris.size.should.be 2
- server.classifier.uris.should.not.include '/arf'
- server.classifier.uris.should.include '/'
- server.classifier.uris.should.include '/bar'
- block_ran = true
- }
- }
- sleep 1
- block_ran.should.be true
- end
-
- specify "should provide a .run that maps a urlmap restricting by host" do
- block_ran = false
- Thread.new {
- map = Rack::URLMap.new({
- '/' => lambda{},
- '/foo' => lambda{},
- '/bar' => lambda{},
- 'http://localhost/' => lambda{},
- 'http://localhost/bar' => lambda{},
- 'http://falsehost/arf' => lambda{},
- 'http://falsehost/qux' => lambda{}
- })
- opt = {:map => true, :Port => 9241, :Host => 'localhost'}
- Rack::Handler::Mongrel.run(map, opt) { |server|
- server.should.be.kind_of Mongrel::HttpServer
- server.classifier.uris.should.include '/'
- server.classifier.handler_map['/'].size.should.be 2
- server.classifier.uris.should.include '/foo'
- server.classifier.handler_map['/foo'].size.should.be 1
- server.classifier.uris.should.include '/bar'
- server.classifier.handler_map['/bar'].size.should.be 2
- server.classifier.uris.should.not.include '/qux'
- server.classifier.uris.should.not.include '/arf'
- server.classifier.uris.size.should.be 3
- block_ran = true
- }
- }
- sleep 1
- block_ran.should.be true
- end
-
- specify "should stream #each part of the response" do
- body = ''
- begin
- Timeout.timeout(1) do
- Net::HTTP.start(@host, @port) do |http|
- get = Net::HTTP::Get.new('/stream')
- http.request(get) do |response|
- response.read_body { |part| body << part }
- end
- end
- end
- rescue Timeout::Error
- end
- body.should.not.be.empty
- end
-
- teardown do
- @acc.raise Mongrel::StopServer
- end
-end
-
-rescue LoadError
- $stderr.puts "Skipping Rack::Handler::Mongrel tests (Mongrel is required). `gem install mongrel` and try again."
-end
diff --git a/vendor/gems/rack-1.1.0/test/spec_rack_nulllogger.rb b/vendor/gems/rack-1.1.0/test/spec_rack_nulllogger.rb
deleted file mode 100644
index b3c2bc9c..00000000
--- a/vendor/gems/rack-1.1.0/test/spec_rack_nulllogger.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-require 'rack/nulllogger'
-require 'rack/lint'
-require 'rack/mock'
-
-context "Rack::NullLogger" do
- specify "acks as a nop logger" do
- app = lambda { |env|
- env['rack.logger'].warn "b00m"
- [200, {'Content-Type' => 'text/plain'}, ["Hello, World!"]]
- }
- Rack::NullLogger.new(app).call({})
- end
-end
diff --git a/vendor/gems/rack-1.1.0/test/spec_rack_recursive.rb b/vendor/gems/rack-1.1.0/test/spec_rack_recursive.rb
deleted file mode 100644
index afc1a0d9..00000000
--- a/vendor/gems/rack-1.1.0/test/spec_rack_recursive.rb
+++ /dev/null
@@ -1,77 +0,0 @@
-require 'test/spec'
-
-require 'rack/recursive'
-require 'rack/urlmap'
-require 'rack/response'
-require 'rack/mock'
-
-context "Rack::Recursive" do
- setup do
-
- @app1 = lambda { |env|
- res = Rack::Response.new
- res["X-Path-Info"] = env["PATH_INFO"]
- res["X-Query-String"] = env["QUERY_STRING"]
- res.finish do |res|
- res.write "App1"
- end
- }
-
- @app2 = lambda { |env|
- Rack::Response.new.finish do |res|
- res.write "App2"
- _, _, body = env['rack.recursive.include'].call(env, "/app1")
- body.each { |b|
- res.write b
- }
- end
- }
-
- @app3 = lambda { |env|
- raise Rack::ForwardRequest.new("/app1")
- }
-
- @app4 = lambda { |env|
- raise Rack::ForwardRequest.new("http://example.org/app1/quux?meh")
- }
-
- end
-
- specify "should allow for subrequests" do
- res = Rack::MockRequest.new(Rack::Recursive.new(
- Rack::URLMap.new("/app1" => @app1,
- "/app2" => @app2))).
- get("/app2")
-
- res.should.be.ok
- res.body.should.equal "App2App1"
- end
-
- specify "should raise error on requests not below the app" do
- app = Rack::URLMap.new("/app1" => @app1,
- "/app" => Rack::Recursive.new(
- Rack::URLMap.new("/1" => @app1,
- "/2" => @app2)))
-
- lambda {
- Rack::MockRequest.new(app).get("/app/2")
- }.should.raise(ArgumentError).
- message.should =~ /can only include below/
- end
-
- specify "should support forwarding" do
- app = Rack::Recursive.new(Rack::URLMap.new("/app1" => @app1,
- "/app3" => @app3,
- "/app4" => @app4))
-
- res = Rack::MockRequest.new(app).get("/app3")
- res.should.be.ok
- res.body.should.equal "App1"
-
- res = Rack::MockRequest.new(app).get("/app4")
- res.should.be.ok
- res.body.should.equal "App1"
- res["X-Path-Info"].should.equal "/quux"
- res["X-Query-String"].should.equal "meh"
- end
-end
diff --git a/vendor/gems/rack-1.1.0/test/spec_rack_request.rb b/vendor/gems/rack-1.1.0/test/spec_rack_request.rb
deleted file mode 100644
index fcdeb484..00000000
--- a/vendor/gems/rack-1.1.0/test/spec_rack_request.rb
+++ /dev/null
@@ -1,545 +0,0 @@
-require 'test/spec'
-require 'stringio'
-
-require 'rack/request'
-require 'rack/mock'
-
-context "Rack::Request" do
- specify "wraps the rack variables" do
- req = Rack::Request.new(Rack::MockRequest.env_for("http://example.com:8080/"))
-
- req.body.should.respond_to? :gets
- req.scheme.should.equal "http"
- req.request_method.should.equal "GET"
-
- req.should.be.get
- req.should.not.be.post
- req.should.not.be.put
- req.should.not.be.delete
- req.should.not.be.head
-
- req.script_name.should.equal ""
- req.path_info.should.equal "/"
- req.query_string.should.equal ""
-
- req.host.should.equal "example.com"
- req.port.should.equal 8080
-
- req.content_length.should.equal "0"
- req.content_type.should.be.nil
- end
-
- specify "can figure out the correct host" do
- req = Rack::Request.new \
- Rack::MockRequest.env_for("/", "HTTP_HOST" => "www2.example.org")
- req.host.should.equal "www2.example.org"
-
- req = Rack::Request.new \
- Rack::MockRequest.env_for("/", "SERVER_NAME" => "example.org", "SERVER_PORT" => "9292")
- req.host.should.equal "example.org"
-
- req = Rack::Request.new \
- Rack::MockRequest.env_for("/", "HTTP_HOST" => "localhost:81", "HTTP_X_FORWARDED_HOST" => "example.org:9292")
- req.host.should.equal "example.org"
-
- env = Rack::MockRequest.env_for("/", "SERVER_ADDR" => "192.168.1.1", "SERVER_PORT" => "9292")
- env.delete("SERVER_NAME")
- req = Rack::Request.new(env)
- req.host.should.equal "192.168.1.1"
-
- env = Rack::MockRequest.env_for("/")
- env.delete("SERVER_NAME")
- req = Rack::Request.new(env)
- req.host.should.equal ""
- end
-
- specify "can parse the query string" do
- req = Rack::Request.new(Rack::MockRequest.env_for("/?foo=bar&quux=bla"))
- req.query_string.should.equal "foo=bar&quux=bla"
- req.GET.should.equal "foo" => "bar", "quux" => "bla"
- req.POST.should.be.empty
- req.params.should.equal "foo" => "bar", "quux" => "bla"
- end
-
- specify "raises if rack.input is missing" do
- req = Rack::Request.new({})
- lambda { req.POST }.should.raise(RuntimeError)
- end
-
- specify "can parse POST data when method is POST and no Content-Type given" do
- req = Rack::Request.new \
- Rack::MockRequest.env_for("/?foo=quux",
- "REQUEST_METHOD" => 'POST',
- :input => "foo=bar&quux=bla")
- req.content_type.should.be.nil
- req.media_type.should.be.nil
- req.query_string.should.equal "foo=quux"
- req.GET.should.equal "foo" => "quux"
- req.POST.should.equal "foo" => "bar", "quux" => "bla"
- req.params.should.equal "foo" => "bar", "quux" => "bla"
- end
-
- specify "can parse POST data with explicit content type regardless of method" do
- req = Rack::Request.new \
- Rack::MockRequest.env_for("/",
- "CONTENT_TYPE" => 'application/x-www-form-urlencoded;foo=bar',
- :input => "foo=bar&quux=bla")
- req.content_type.should.equal 'application/x-www-form-urlencoded;foo=bar'
- req.media_type.should.equal 'application/x-www-form-urlencoded'
- req.media_type_params['foo'].should.equal 'bar'
- req.POST.should.equal "foo" => "bar", "quux" => "bla"
- req.params.should.equal "foo" => "bar", "quux" => "bla"
- end
-
- specify "does not parse POST data when media type is not form-data" do
- req = Rack::Request.new \
- Rack::MockRequest.env_for("/?foo=quux",
- "REQUEST_METHOD" => 'POST',
- "CONTENT_TYPE" => 'text/plain;charset=utf-8',
- :input => "foo=bar&quux=bla")
- req.content_type.should.equal 'text/plain;charset=utf-8'
- req.media_type.should.equal 'text/plain'
- req.media_type_params['charset'].should.equal 'utf-8'
- req.POST.should.be.empty
- req.params.should.equal "foo" => "quux"
- req.body.read.should.equal "foo=bar&quux=bla"
- end
-
- specify "can parse POST data on PUT when media type is form-data" do
- req = Rack::Request.new \
- Rack::MockRequest.env_for("/?foo=quux",
- "REQUEST_METHOD" => 'PUT',
- "CONTENT_TYPE" => 'application/x-www-form-urlencoded',
- :input => "foo=bar&quux=bla")
- req.POST.should.equal "foo" => "bar", "quux" => "bla"
- req.body.read.should.equal "foo=bar&quux=bla"
- end
-
- specify "rewinds input after parsing POST data" do
- input = StringIO.new("foo=bar&quux=bla")
- req = Rack::Request.new \
- Rack::MockRequest.env_for("/",
- "CONTENT_TYPE" => 'application/x-www-form-urlencoded;foo=bar',
- :input => input)
- req.params.should.equal "foo" => "bar", "quux" => "bla"
- input.read.should.equal "foo=bar&quux=bla"
- end
-
- specify "cleans up Safari's ajax POST body" do
- req = Rack::Request.new \
- Rack::MockRequest.env_for("/",
- 'REQUEST_METHOD' => 'POST', :input => "foo=bar&quux=bla\0")
- req.POST.should.equal "foo" => "bar", "quux" => "bla"
- end
-
- specify "can get value by key from params with #[]" do
- req = Rack::Request.new \
- Rack::MockRequest.env_for("?foo=quux")
- req['foo'].should.equal 'quux'
- req[:foo].should.equal 'quux'
- end
-
- specify "can set value to key on params with #[]=" do
- req = Rack::Request.new \
- Rack::MockRequest.env_for("?foo=duh")
- req['foo'].should.equal 'duh'
- req[:foo].should.equal 'duh'
- req.params.should.equal 'foo' => 'duh'
-
- req['foo'] = 'bar'
- req.params.should.equal 'foo' => 'bar'
- req['foo'].should.equal 'bar'
- req[:foo].should.equal 'bar'
-
- req[:foo] = 'jaz'
- req.params.should.equal 'foo' => 'jaz'
- req['foo'].should.equal 'jaz'
- req[:foo].should.equal 'jaz'
- end
-
- specify "values_at answers values by keys in order given" do
- req = Rack::Request.new \
- Rack::MockRequest.env_for("?foo=baz&wun=der&bar=ful")
- req.values_at('foo').should.equal ['baz']
- req.values_at('foo', 'wun').should.equal ['baz', 'der']
- req.values_at('bar', 'foo', 'wun').should.equal ['ful', 'baz', 'der']
- end
-
- specify "referrer should be extracted correct" do
- req = Rack::Request.new \
- Rack::MockRequest.env_for("/", "HTTP_REFERER" => "/some/path")
- req.referer.should.equal "/some/path"
-
- req = Rack::Request.new \
- Rack::MockRequest.env_for("/")
- req.referer.should.equal "/"
- end
-
- specify "user agent should be extracted correct" do
- req = Rack::Request.new \
- Rack::MockRequest.env_for("/", "HTTP_USER_AGENT" => "Mozilla/4.0 (compatible)")
- req.user_agent.should.equal "Mozilla/4.0 (compatible)"
-
- req = Rack::Request.new \
- Rack::MockRequest.env_for("/")
- req.user_agent.should.equal nil
- end
-
- specify "can cache, but invalidates the cache" do
- req = Rack::Request.new \
- Rack::MockRequest.env_for("/?foo=quux",
- "CONTENT_TYPE" => "application/x-www-form-urlencoded",
- :input => "foo=bar&quux=bla")
- req.GET.should.equal "foo" => "quux"
- req.GET.should.equal "foo" => "quux"
- req.env["QUERY_STRING"] = "bla=foo"
- req.GET.should.equal "bla" => "foo"
- req.GET.should.equal "bla" => "foo"
-
- req.POST.should.equal "foo" => "bar", "quux" => "bla"
- req.POST.should.equal "foo" => "bar", "quux" => "bla"
- req.env["rack.input"] = StringIO.new("foo=bla&quux=bar")
- req.POST.should.equal "foo" => "bla", "quux" => "bar"
- req.POST.should.equal "foo" => "bla", "quux" => "bar"
- end
-
- specify "can figure out if called via XHR" do
- req = Rack::Request.new(Rack::MockRequest.env_for(""))
- req.should.not.be.xhr
-
- req = Rack::Request.new \
- Rack::MockRequest.env_for("", "HTTP_X_REQUESTED_WITH" => "XMLHttpRequest")
- req.should.be.xhr
- end
-
- specify "can parse cookies" do
- req = Rack::Request.new \
- Rack::MockRequest.env_for("", "HTTP_COOKIE" => "foo=bar;quux=h&m")
- req.cookies.should.equal "foo" => "bar", "quux" => "h&m"
- req.cookies.should.equal "foo" => "bar", "quux" => "h&m"
- req.env.delete("HTTP_COOKIE")
- req.cookies.should.equal({})
- end
-
- specify "parses cookies according to RFC 2109" do
- req = Rack::Request.new \
- Rack::MockRequest.env_for('', 'HTTP_COOKIE' => 'foo=bar;foo=car')
- req.cookies.should.equal 'foo' => 'bar'
- end
-
- specify "provides setters" do
- req = Rack::Request.new(e=Rack::MockRequest.env_for(""))
- req.script_name.should.equal ""
- req.script_name = "/foo"
- req.script_name.should.equal "/foo"
- e["SCRIPT_NAME"].should.equal "/foo"
-
- req.path_info.should.equal "/"
- req.path_info = "/foo"
- req.path_info.should.equal "/foo"
- e["PATH_INFO"].should.equal "/foo"
- end
-
- specify "provides the original env" do
- req = Rack::Request.new(e=Rack::MockRequest.env_for(""))
- req.env.should.be e
- end
-
- specify "can restore the URL" do
- Rack::Request.new(Rack::MockRequest.env_for("")).url.
- should.equal "http://example.org/"
- Rack::Request.new(Rack::MockRequest.env_for("", "SCRIPT_NAME" => "/foo")).url.
- should.equal "http://example.org/foo/"
- Rack::Request.new(Rack::MockRequest.env_for("/foo")).url.
- should.equal "http://example.org/foo"
- Rack::Request.new(Rack::MockRequest.env_for("?foo")).url.
- should.equal "http://example.org/?foo"
- Rack::Request.new(Rack::MockRequest.env_for("http://example.org:8080/")).url.
- should.equal "http://example.org:8080/"
- Rack::Request.new(Rack::MockRequest.env_for("https://example.org/")).url.
- should.equal "https://example.org/"
-
- Rack::Request.new(Rack::MockRequest.env_for("https://example.com:8080/foo?foo")).url.
- should.equal "https://example.com:8080/foo?foo"
- end
-
- specify "can restore the full path" do
- Rack::Request.new(Rack::MockRequest.env_for("")).fullpath.
- should.equal "/"
- Rack::Request.new(Rack::MockRequest.env_for("", "SCRIPT_NAME" => "/foo")).fullpath.
- should.equal "/foo/"
- Rack::Request.new(Rack::MockRequest.env_for("/foo")).fullpath.
- should.equal "/foo"
- Rack::Request.new(Rack::MockRequest.env_for("?foo")).fullpath.
- should.equal "/?foo"
- Rack::Request.new(Rack::MockRequest.env_for("http://example.org:8080/")).fullpath.
- should.equal "/"
- Rack::Request.new(Rack::MockRequest.env_for("https://example.org/")).fullpath.
- should.equal "/"
-
- Rack::Request.new(Rack::MockRequest.env_for("https://example.com:8080/foo?foo")).fullpath.
- should.equal "/foo?foo"
- end
-
- specify "can handle multiple media type parameters" do
- req = Rack::Request.new \
- Rack::MockRequest.env_for("/",
- "CONTENT_TYPE" => 'text/plain; foo=BAR,baz=bizzle dizzle;BLING=bam')
- req.should.not.be.form_data
- req.media_type_params.should.include 'foo'
- req.media_type_params['foo'].should.equal 'BAR'
- req.media_type_params.should.include 'baz'
- req.media_type_params['baz'].should.equal 'bizzle dizzle'
- req.media_type_params.should.not.include 'BLING'
- req.media_type_params.should.include 'bling'
- req.media_type_params['bling'].should.equal 'bam'
- end
-
- specify "can parse multipart form data" do
- # Adapted from RFC 1867.
- input = < "multipart/form-data, boundary=AaB03x",
- "CONTENT_LENGTH" => input.size,
- :input => input)
-
- req.POST.should.include "fileupload"
- req.POST.should.include "reply"
-
- req.should.be.form_data
- req.content_length.should.equal input.size
- req.media_type.should.equal 'multipart/form-data'
- req.media_type_params.should.include 'boundary'
- req.media_type_params['boundary'].should.equal 'AaB03x'
-
- req.POST["reply"].should.equal "yes"
-
- f = req.POST["fileupload"]
- f.should.be.kind_of Hash
- f[:type].should.equal "image/jpeg"
- f[:filename].should.equal "dj.jpg"
- f.should.include :tempfile
- f[:tempfile].size.should.equal 76
- end
-
- specify "can parse big multipart form data" do
- input = < "multipart/form-data, boundary=AaB03x",
- "CONTENT_LENGTH" => input.size,
- :input => input)
-
- req.POST["huge"][:tempfile].size.should.equal 32768
- req.POST["mean"][:tempfile].size.should.equal 10
- req.POST["mean"][:tempfile].read.should.equal "--AaB03xha"
- end
-
- specify "can detect invalid multipart form data" do
- input = < "multipart/form-data, boundary=AaB03x",
- "CONTENT_LENGTH" => input.size,
- :input => input)
-
- lambda { req.POST }.should.raise(EOFError)
-
- input = < "multipart/form-data, boundary=AaB03x",
- "CONTENT_LENGTH" => input.size,
- :input => input)
-
- lambda { req.POST }.should.raise(EOFError)
-
- input = < "multipart/form-data, boundary=AaB03x",
- "CONTENT_LENGTH" => input.size,
- :input => input)
-
- lambda { req.POST }.should.raise(EOFError)
- end
-
- specify "shouldn't try to interpret binary as utf8" do
- begin
- original_kcode = $KCODE
- $KCODE='UTF8'
-
- input = < "multipart/form-data, boundary=AaB03x",
- "CONTENT_LENGTH" => input.size,
- :input => input)
-
- lambda{req.POST}.should.not.raise(EOFError)
- req.POST["fileupload"][:tempfile].size.should.equal 4
- ensure
- $KCODE = original_kcode
- end
- end
-
-
- specify "should work around buggy 1.8.* Tempfile equality" do
- input = < "multipart/form-data, boundary=AaB03x",
- "CONTENT_LENGTH" => input.size,
- :input => rack_input)
-
- lambda {req.POST}.should.not.raise
- lambda {req.POST}.should.blaming("input re-processed!").not.raise
- end
-
- specify "does conform to the Rack spec" do
- app = lambda { |env|
- content = Rack::Request.new(env).POST["file"].inspect
- size = content.respond_to?(:bytesize) ? content.bytesize : content.size
- [200, {"Content-Type" => "text/html", "Content-Length" => size.to_s}, [content]]
- }
-
- input = < "multipart/form-data, boundary=AaB03x",
- "CONTENT_LENGTH" => input.size.to_s, "rack.input" => StringIO.new(input)
-
- res.should.be.ok
- end
-
- specify "should parse Accept-Encoding correctly" do
- parser = lambda do |x|
- Rack::Request.new(Rack::MockRequest.env_for("", "HTTP_ACCEPT_ENCODING" => x)).accept_encoding
- end
-
- parser.call(nil).should.equal([])
-
- parser.call("compress, gzip").should.equal([["compress", 1.0], ["gzip", 1.0]])
- parser.call("").should.equal([])
- parser.call("*").should.equal([["*", 1.0]])
- parser.call("compress;q=0.5, gzip;q=1.0").should.equal([["compress", 0.5], ["gzip", 1.0]])
- parser.call("gzip;q=1.0, identity; q=0.5, *;q=0").should.equal([["gzip", 1.0], ["identity", 0.5], ["*", 0] ])
-
- lambda { parser.call("gzip ; q=1.0") }.should.raise(RuntimeError)
- end
-
- specify 'should provide ip information' do
- app = lambda { |env|
- request = Rack::Request.new(env)
- response = Rack::Response.new
- response.write request.ip
- response.finish
- }
-
- mock = Rack::MockRequest.new(Rack::Lint.new(app))
- res = mock.get '/', 'REMOTE_ADDR' => '123.123.123.123'
- res.body.should.equal '123.123.123.123'
-
- res = mock.get '/',
- 'REMOTE_ADDR' => '123.123.123.123',
- 'HTTP_X_FORWARDED_FOR' => '234.234.234.234'
-
- res.body.should.equal '234.234.234.234'
-
- res = mock.get '/',
- 'REMOTE_ADDR' => '123.123.123.123',
- 'HTTP_X_FORWARDED_FOR' => '234.234.234.234,212.212.212.212'
-
- res.body.should.equal '212.212.212.212'
- end
-
- class MyRequest < Rack::Request
- def params
- {:foo => "bar"}
- end
- end
-
- specify "should allow subclass request to be instantiated after parent request" do
- env = Rack::MockRequest.env_for("/?foo=bar")
-
- req1 = Rack::Request.new(env)
- req1.GET.should.equal "foo" => "bar"
- req1.params.should.equal "foo" => "bar"
-
- req2 = MyRequest.new(env)
- req2.GET.should.equal "foo" => "bar"
- req2.params.should.equal :foo => "bar"
- end
-
- specify "should allow parent request to be instantiated after subclass request" do
- env = Rack::MockRequest.env_for("/?foo=bar")
-
- req1 = MyRequest.new(env)
- req1.GET.should.equal "foo" => "bar"
- req1.params.should.equal :foo => "bar"
-
- req2 = Rack::Request.new(env)
- req2.GET.should.equal "foo" => "bar"
- req2.params.should.equal "foo" => "bar"
- end
-end
diff --git a/vendor/gems/rack-1.1.0/test/spec_rack_response.rb b/vendor/gems/rack-1.1.0/test/spec_rack_response.rb
deleted file mode 100644
index 7989013d..00000000
--- a/vendor/gems/rack-1.1.0/test/spec_rack_response.rb
+++ /dev/null
@@ -1,221 +0,0 @@
-require 'test/spec'
-require 'set'
-
-require 'rack/response'
-
-context "Rack::Response" do
- specify "has sensible default values" do
- response = Rack::Response.new
- status, header, body = response.finish
- status.should.equal 200
- header.should.equal "Content-Type" => "text/html"
- body.each { |part|
- part.should.equal ""
- }
-
- response = Rack::Response.new
- status, header, body = *response
- status.should.equal 200
- header.should.equal "Content-Type" => "text/html"
- body.each { |part|
- part.should.equal ""
- }
- end
-
- specify "can be written to" do
- response = Rack::Response.new
-
- status, header, body = response.finish do
- response.write "foo"
- response.write "bar"
- response.write "baz"
- end
-
- parts = []
- body.each { |part| parts << part }
-
- parts.should.equal ["foo", "bar", "baz"]
- end
-
- specify "can set and read headers" do
- response = Rack::Response.new
- response["Content-Type"].should.equal "text/html"
- response["Content-Type"] = "text/plain"
- response["Content-Type"].should.equal "text/plain"
- end
-
- specify "can set cookies" do
- response = Rack::Response.new
-
- response.set_cookie "foo", "bar"
- response["Set-Cookie"].should.equal "foo=bar"
- response.set_cookie "foo2", "bar2"
- response["Set-Cookie"].should.equal ["foo=bar", "foo2=bar2"]
- response.set_cookie "foo3", "bar3"
- response["Set-Cookie"].should.equal ["foo=bar", "foo2=bar2", "foo3=bar3"]
- end
-
- specify "formats the Cookie expiration date accordingly to RFC 2109" do
- response = Rack::Response.new
-
- response.set_cookie "foo", {:value => "bar", :expires => Time.now+10}
- response["Set-Cookie"].should.match(
- /expires=..., \d\d-...-\d\d\d\d \d\d:\d\d:\d\d .../)
- end
-
- specify "can set secure cookies" do
- response = Rack::Response.new
- response.set_cookie "foo", {:value => "bar", :secure => true}
- response["Set-Cookie"].should.equal "foo=bar; secure"
- end
-
- specify "can set http only cookies" do
- response = Rack::Response.new
- response.set_cookie "foo", {:value => "bar", :httponly => true}
- response["Set-Cookie"].should.equal "foo=bar; HttpOnly"
- end
-
- specify "can delete cookies" do
- response = Rack::Response.new
- response.set_cookie "foo", "bar"
- response.set_cookie "foo2", "bar2"
- response.delete_cookie "foo"
- response["Set-Cookie"].should.equal ["foo2=bar2",
- "foo=; expires=Thu, 01-Jan-1970 00:00:00 GMT"]
- end
-
- specify "can do redirects" do
- response = Rack::Response.new
- response.redirect "/foo"
- status, header, body = response.finish
-
- status.should.equal 302
- header["Location"].should.equal "/foo"
-
- response = Rack::Response.new
- response.redirect "/foo", 307
- status, header, body = response.finish
-
- status.should.equal 307
- end
-
- specify "has a useful constructor" do
- r = Rack::Response.new("foo")
- status, header, body = r.finish
- str = ""; body.each { |part| str << part }
- str.should.equal "foo"
-
- r = Rack::Response.new(["foo", "bar"])
- status, header, body = r.finish
- str = ""; body.each { |part| str << part }
- str.should.equal "foobar"
-
- r = Rack::Response.new(["foo", "bar"].to_set)
- r.write "foo"
- status, header, body = r.finish
- str = ""; body.each { |part| str << part }
- str.should.equal "foobarfoo"
-
- r = Rack::Response.new([], 500)
- r.status.should.equal 500
-
- r = Rack::Response.new([], "200 OK")
- r.status.should.equal 200
- end
-
- specify "has a constructor that can take a block" do
- r = Rack::Response.new { |res|
- res.status = 404
- res.write "foo"
- }
- status, header, body = r.finish
- str = ""; body.each { |part| str << part }
- str.should.equal "foo"
- status.should.equal 404
- end
-
- specify "doesn't return invalid responses" do
- r = Rack::Response.new(["foo", "bar"], 204)
- status, header, body = r.finish
- str = ""; body.each { |part| str << part }
- str.should.be.empty
- header["Content-Type"].should.equal nil
-
- lambda {
- Rack::Response.new(Object.new)
- }.should.raise(TypeError).
- message.should =~ /stringable or iterable required/
- end
-
- specify "knows if it's empty" do
- r = Rack::Response.new
- r.should.be.empty
- r.write "foo"
- r.should.not.be.empty
-
- r = Rack::Response.new
- r.should.be.empty
- r.finish
- r.should.be.empty
-
- r = Rack::Response.new
- r.should.be.empty
- r.finish { }
- r.should.not.be.empty
- end
-
- specify "should provide access to the HTTP status" do
- res = Rack::Response.new
- res.status = 200
- res.should.be.successful
- res.should.be.ok
-
- res.status = 404
- res.should.not.be.successful
- res.should.be.client_error
- res.should.be.not_found
-
- res.status = 501
- res.should.not.be.successful
- res.should.be.server_error
-
- res.status = 307
- res.should.be.redirect
- end
-
- specify "should provide access to the HTTP headers" do
- res = Rack::Response.new
- res["Content-Type"] = "text/yaml"
-
- res.should.include "Content-Type"
- res.headers["Content-Type"].should.equal "text/yaml"
- res["Content-Type"].should.equal "text/yaml"
- res.content_type.should.equal "text/yaml"
- res.content_length.should.be.nil
- res.location.should.be.nil
- end
-
- specify "does not add or change Content-Length when #finish()ing" do
- res = Rack::Response.new
- res.status = 200
- res.finish
- res.headers["Content-Length"].should.be.nil
-
- res = Rack::Response.new
- res.status = 200
- res.headers["Content-Length"] = "10"
- res.finish
- res.headers["Content-Length"].should.equal "10"
- end
-
- specify "updates Content-Length when body appended to using #write" do
- res = Rack::Response.new
- res.status = 200
- res.headers["Content-Length"].should.be.nil
- res.write "Hi"
- res.headers["Content-Length"].should.equal "2"
- res.write " there"
- res.headers["Content-Length"].should.equal "8"
- end
-
-end
diff --git a/vendor/gems/rack-1.1.0/test/spec_rack_rewindable_input.rb b/vendor/gems/rack-1.1.0/test/spec_rack_rewindable_input.rb
deleted file mode 100644
index 78bebfc9..00000000
--- a/vendor/gems/rack-1.1.0/test/spec_rack_rewindable_input.rb
+++ /dev/null
@@ -1,118 +0,0 @@
-require 'test/spec'
-require 'stringio'
-require 'rack/rewindable_input'
-
-shared_context "a rewindable IO object" do
- setup do
- @rio = Rack::RewindableInput.new(@io)
- end
-
- teardown do
- @rio.close
- end
-
- specify "should be able to handle to read()" do
- @rio.read.should.equal "hello world"
- end
-
- specify "should be able to handle to read(nil)" do
- @rio.read(nil).should.equal "hello world"
- end
-
- specify "should be able to handle to read(length)" do
- @rio.read(1).should.equal "h"
- end
-
- specify "should be able to handle to read(length, buffer)" do
- buffer = ""
- result = @rio.read(1, buffer)
- result.should.equal "h"
- result.object_id.should.equal buffer.object_id
- end
-
- specify "should be able to handle to read(nil, buffer)" do
- buffer = ""
- result = @rio.read(nil, buffer)
- result.should.equal "hello world"
- result.object_id.should.equal buffer.object_id
- end
-
- specify "should rewind to the beginning when #rewind is called" do
- @rio.read(1)
- @rio.rewind
- @rio.read.should.equal "hello world"
- end
-
- specify "should be able to handle gets" do
- @rio.gets.should == "hello world"
- end
-
- specify "should be able to handle each" do
- array = []
- @rio.each do |data|
- array << data
- end
- array.should.equal(["hello world"])
- end
-
- specify "should not buffer into a Tempfile if no data has been read yet" do
- @rio.instance_variable_get(:@rewindable_io).should.be.nil
- end
-
- specify "should buffer into a Tempfile when data has been consumed for the first time" do
- @rio.read(1)
- tempfile = @rio.instance_variable_get(:@rewindable_io)
- tempfile.should.not.be.nil
- @rio.read(1)
- tempfile2 = @rio.instance_variable_get(:@rewindable_io)
- tempfile2.should.equal tempfile
- end
-
- specify "should close the underlying tempfile upon calling #close" do
- @rio.read(1)
- tempfile = @rio.instance_variable_get(:@rewindable_io)
- @rio.close
- tempfile.should.be.closed
- end
-
- specify "should be possibel to call #close when no data has been buffered yet" do
- @rio.close
- end
-
- specify "should be possible to call #close multiple times" do
- @rio.close
- @rio.close
- end
-end
-
-context "Rack::RewindableInput" do
- context "given an IO object that is already rewindable" do
- setup do
- @io = StringIO.new("hello world")
- end
-
- it_should_behave_like "a rewindable IO object"
- end
-
- context "given an IO object that is not rewindable" do
- setup do
- @io = StringIO.new("hello world")
- @io.instance_eval do
- undef :rewind
- end
- end
-
- it_should_behave_like "a rewindable IO object"
- end
-
- context "given an IO object whose rewind method raises Errno::ESPIPE" do
- setup do
- @io = StringIO.new("hello world")
- def @io.rewind
- raise Errno::ESPIPE, "You can't rewind this!"
- end
- end
-
- it_should_behave_like "a rewindable IO object"
- end
-end
diff --git a/vendor/gems/rack-1.1.0/test/spec_rack_runtime.rb b/vendor/gems/rack-1.1.0/test/spec_rack_runtime.rb
deleted file mode 100644
index 62d80956..00000000
--- a/vendor/gems/rack-1.1.0/test/spec_rack_runtime.rb
+++ /dev/null
@@ -1,35 +0,0 @@
-require 'test/spec'
-require 'rack/mock'
-require 'rack/runtime'
-
-context "Rack::Runtime" do
- specify "sets X-Runtime is none is set" do
- app = lambda { |env| [200, {'Content-Type' => 'text/plain'}, "Hello, World!"] }
- response = Rack::Runtime.new(app).call({})
- response[1]['X-Runtime'].should =~ /[\d\.]+/
- end
-
- specify "does not set the X-Runtime if it is already set" do
- app = lambda { |env| [200, {'Content-Type' => 'text/plain', "X-Runtime" => "foobar"}, "Hello, World!"] }
- response = Rack::Runtime.new(app).call({})
- response[1]['X-Runtime'].should == "foobar"
- end
-
- specify "should allow a suffix to be set" do
- app = lambda { |env| [200, {'Content-Type' => 'text/plain'}, "Hello, World!"] }
- response = Rack::Runtime.new(app, "Test").call({})
- response[1]['X-Runtime-Test'].should =~ /[\d\.]+/
- end
-
- specify "should allow multiple timers to be set" do
- app = lambda { |env| [200, {'Content-Type' => 'text/plain'}, "Hello, World!"] }
- runtime1 = Rack::Runtime.new(app, "App")
- runtime2 = Rack::Runtime.new(runtime1, "All")
- response = runtime2.call({})
-
- response[1]['X-Runtime-App'].should =~ /[\d\.]+/
- response[1]['X-Runtime-All'].should =~ /[\d\.]+/
-
- Float(response[1]['X-Runtime-All']).should > Float(response[1]['X-Runtime-App'])
- end
-end
diff --git a/vendor/gems/rack-1.1.0/test/spec_rack_sendfile.rb b/vendor/gems/rack-1.1.0/test/spec_rack_sendfile.rb
deleted file mode 100644
index 8cfe2017..00000000
--- a/vendor/gems/rack-1.1.0/test/spec_rack_sendfile.rb
+++ /dev/null
@@ -1,86 +0,0 @@
-require 'test/spec'
-require 'rack/mock'
-require 'rack/sendfile'
-
-context "Rack::File" do
- specify "should respond to #to_path" do
- Rack::File.new(Dir.pwd).should.respond_to :to_path
- end
-end
-
-context "Rack::Sendfile" do
- def sendfile_body
- res = ['Hello World']
- def res.to_path ; "/tmp/hello.txt" ; end
- res
- end
-
- def simple_app(body=sendfile_body)
- lambda { |env| [200, {'Content-Type' => 'text/plain'}, body] }
- end
-
- def sendfile_app(body=sendfile_body)
- Rack::Sendfile.new(simple_app(body))
- end
-
- setup do
- @request = Rack::MockRequest.new(sendfile_app)
- end
-
- def request(headers={})
- yield @request.get('/', headers)
- end
-
- specify "does nothing when no X-Sendfile-Type header present" do
- request do |response|
- response.should.be.ok
- response.body.should.equal 'Hello World'
- response.headers.should.not.include 'X-Sendfile'
- end
- end
-
- specify "sets X-Sendfile response header and discards body" do
- request 'HTTP_X_SENDFILE_TYPE' => 'X-Sendfile' do |response|
- response.should.be.ok
- response.body.should.be.empty
- response.headers['X-Sendfile'].should.equal '/tmp/hello.txt'
- end
- end
-
- specify "sets X-Lighttpd-Send-File response header and discards body" do
- request 'HTTP_X_SENDFILE_TYPE' => 'X-Lighttpd-Send-File' do |response|
- response.should.be.ok
- response.body.should.be.empty
- response.headers['X-Lighttpd-Send-File'].should.equal '/tmp/hello.txt'
- end
- end
-
- specify "sets X-Accel-Redirect response header and discards body" do
- headers = {
- 'HTTP_X_SENDFILE_TYPE' => 'X-Accel-Redirect',
- 'HTTP_X_ACCEL_MAPPING' => '/tmp/=/foo/bar/'
- }
- request headers do |response|
- response.should.be.ok
- response.body.should.be.empty
- response.headers['X-Accel-Redirect'].should.equal '/foo/bar/hello.txt'
- end
- end
-
- specify 'writes to rack.error when no X-Accel-Mapping is specified' do
- request 'HTTP_X_SENDFILE_TYPE' => 'X-Accel-Redirect' do |response|
- response.should.be.ok
- response.body.should.equal 'Hello World'
- response.headers.should.not.include 'X-Accel-Redirect'
- response.errors.should.include 'X-Accel-Mapping'
- end
- end
-
- specify 'does nothing when body does not respond to #to_path' do
- @request = Rack::MockRequest.new(sendfile_app(['Not a file...']))
- request 'HTTP_X_SENDFILE_TYPE' => 'X-Sendfile' do |response|
- response.body.should.equal 'Not a file...'
- response.headers.should.not.include 'X-Sendfile'
- end
- end
-end
diff --git a/vendor/gems/rack-1.1.0/test/spec_rack_session_cookie.rb b/vendor/gems/rack-1.1.0/test/spec_rack_session_cookie.rb
deleted file mode 100644
index fba3f83b..00000000
--- a/vendor/gems/rack-1.1.0/test/spec_rack_session_cookie.rb
+++ /dev/null
@@ -1,73 +0,0 @@
-require 'test/spec'
-
-require 'rack/session/cookie'
-require 'rack/mock'
-require 'rack/response'
-
-context "Rack::Session::Cookie" do
- incrementor = lambda { |env|
- env["rack.session"]["counter"] ||= 0
- env["rack.session"]["counter"] += 1
- Rack::Response.new(env["rack.session"].inspect).to_a
- }
-
- specify "creates a new cookie" do
- res = Rack::MockRequest.new(Rack::Session::Cookie.new(incrementor)).get("/")
- res["Set-Cookie"].should.match("rack.session=")
- res.body.should.equal '{"counter"=>1}'
- end
-
- specify "loads from a cookie" do
- res = Rack::MockRequest.new(Rack::Session::Cookie.new(incrementor)).get("/")
- cookie = res["Set-Cookie"]
- res = Rack::MockRequest.new(Rack::Session::Cookie.new(incrementor)).
- get("/", "HTTP_COOKIE" => cookie)
- res.body.should.equal '{"counter"=>2}'
- cookie = res["Set-Cookie"]
- res = Rack::MockRequest.new(Rack::Session::Cookie.new(incrementor)).
- get("/", "HTTP_COOKIE" => cookie)
- res.body.should.equal '{"counter"=>3}'
- end
-
- specify "survives broken cookies" do
- res = Rack::MockRequest.new(Rack::Session::Cookie.new(incrementor)).
- get("/", "HTTP_COOKIE" => "rack.session=blarghfasel")
- res.body.should.equal '{"counter"=>1}'
- end
-
- bigcookie = lambda { |env|
- env["rack.session"]["cookie"] = "big" * 3000
- Rack::Response.new(env["rack.session"].inspect).to_a
- }
-
- specify "barks on too big cookies" do
- lambda {
- Rack::MockRequest.new(Rack::Session::Cookie.new(bigcookie)).
- get("/", :fatal => true)
- }.should.raise(Rack::MockRequest::FatalWarning)
- end
-
- specify "loads from a cookie wih integrity hash" do
- res = Rack::MockRequest.new(Rack::Session::Cookie.new(incrementor, :secret => 'test')).get("/")
- cookie = res["Set-Cookie"]
- res = Rack::MockRequest.new(Rack::Session::Cookie.new(incrementor, :secret => 'test')).
- get("/", "HTTP_COOKIE" => cookie)
- res.body.should.equal '{"counter"=>2}'
- cookie = res["Set-Cookie"]
- res = Rack::MockRequest.new(Rack::Session::Cookie.new(incrementor, :secret => 'test')).
- get("/", "HTTP_COOKIE" => cookie)
- res.body.should.equal '{"counter"=>3}'
- end
-
- specify "ignores tampered with session cookies" do
- app = Rack::Session::Cookie.new(incrementor, :secret => 'test')
- response1 = Rack::MockRequest.new(app).get("/")
- _, digest = response1["Set-Cookie"].split("--")
- tampered_with_cookie = "hackerman-was-here" + "--" + digest
- response2 = Rack::MockRequest.new(app).get("/", "HTTP_COOKIE" =>
- tampered_with_cookie)
-
- # The tampered-with cookie is ignored, so we get back an identical Set-Cookie
- response2["Set-Cookie"].should.equal(response1["Set-Cookie"])
- end
-end
diff --git a/vendor/gems/rack-1.1.0/test/spec_rack_session_memcache.rb b/vendor/gems/rack-1.1.0/test/spec_rack_session_memcache.rb
deleted file mode 100644
index faac796e..00000000
--- a/vendor/gems/rack-1.1.0/test/spec_rack_session_memcache.rb
+++ /dev/null
@@ -1,273 +0,0 @@
-require 'test/spec'
-
-begin
- require 'rack/session/memcache'
- require 'rack/mock'
- require 'rack/response'
- require 'thread'
-
- context "Rack::Session::Memcache" do
- session_key = Rack::Session::Memcache::DEFAULT_OPTIONS[:key]
- session_match = /#{session_key}=([0-9a-fA-F]+);/
- incrementor = lambda do |env|
- env["rack.session"]["counter"] ||= 0
- env["rack.session"]["counter"] += 1
- Rack::Response.new(env["rack.session"].inspect).to_a
- end
- drop_session = proc do |env|
- env['rack.session.options'][:drop] = true
- incrementor.call(env)
- end
- renew_session = proc do |env|
- env['rack.session.options'][:renew] = true
- incrementor.call(env)
- end
- defer_session = proc do |env|
- env['rack.session.options'][:defer] = true
- incrementor.call(env)
- end
-
- specify "faults on no connection" do
- if RUBY_VERSION < "1.9"
- lambda do
- Rack::Session::Memcache.new incrementor, :memcache_server => 'nosuchserver'
- end.should.raise
- else
- lambda do
- Rack::Session::Memcache.new incrementor, :memcache_server => 'nosuchserver'
- end.should.raise ArgumentError
- end
- end
-
- specify "connect to existing server" do
- test_pool = MemCache.new incrementor, :namespace => 'test:rack:session'
- end
-
- specify "creates a new cookie" do
- pool = Rack::Session::Memcache.new(incrementor)
- res = Rack::MockRequest.new(pool).get("/")
- res["Set-Cookie"].should.match("#{session_key}=")
- res.body.should.equal '{"counter"=>1}'
- end
-
- specify "determines session from a cookie" do
- pool = Rack::Session::Memcache.new(incrementor)
- req = Rack::MockRequest.new(pool)
- res = req.get("/")
- cookie = res["Set-Cookie"]
- req.get("/", "HTTP_COOKIE" => cookie).
- body.should.equal '{"counter"=>2}'
- req.get("/", "HTTP_COOKIE" => cookie).
- body.should.equal '{"counter"=>3}'
- end
-
- specify "survives nonexistant cookies" do
- bad_cookie = "rack.session=blarghfasel"
- pool = Rack::Session::Memcache.new(incrementor)
- res = Rack::MockRequest.new(pool).
- get("/", "HTTP_COOKIE" => bad_cookie)
- res.body.should.equal '{"counter"=>1}'
- cookie = res["Set-Cookie"][session_match]
- cookie.should.not.match(/#{bad_cookie}/)
- end
-
- specify "maintains freshness" do
- pool = Rack::Session::Memcache.new(incrementor, :expire_after => 3)
- res = Rack::MockRequest.new(pool).get('/')
- res.body.should.include '"counter"=>1'
- cookie = res["Set-Cookie"]
- res = Rack::MockRequest.new(pool).get('/', "HTTP_COOKIE" => cookie)
- res["Set-Cookie"].should.equal cookie
- res.body.should.include '"counter"=>2'
- puts 'Sleeping to expire session' if $DEBUG
- sleep 4
- res = Rack::MockRequest.new(pool).get('/', "HTTP_COOKIE" => cookie)
- res["Set-Cookie"].should.not.equal cookie
- res.body.should.include '"counter"=>1'
- end
-
- specify "deletes cookies with :drop option" do
- pool = Rack::Session::Memcache.new(incrementor)
- req = Rack::MockRequest.new(pool)
- drop = Rack::Utils::Context.new(pool, drop_session)
- dreq = Rack::MockRequest.new(drop)
-
- res0 = req.get("/")
- session = (cookie = res0["Set-Cookie"])[session_match]
- res0.body.should.equal '{"counter"=>1}'
-
- res1 = req.get("/", "HTTP_COOKIE" => cookie)
- res1["Set-Cookie"][session_match].should.equal session
- res1.body.should.equal '{"counter"=>2}'
-
- res2 = dreq.get("/", "HTTP_COOKIE" => cookie)
- res2["Set-Cookie"].should.equal nil
- res2.body.should.equal '{"counter"=>3}'
-
- res3 = req.get("/", "HTTP_COOKIE" => cookie)
- res3["Set-Cookie"][session_match].should.not.equal session
- res3.body.should.equal '{"counter"=>1}'
- end
-
- specify "provides new session id with :renew option" do
- pool = Rack::Session::Memcache.new(incrementor)
- req = Rack::MockRequest.new(pool)
- renew = Rack::Utils::Context.new(pool, renew_session)
- rreq = Rack::MockRequest.new(renew)
-
- res0 = req.get("/")
- session = (cookie = res0["Set-Cookie"])[session_match]
- res0.body.should.equal '{"counter"=>1}'
-
- res1 = req.get("/", "HTTP_COOKIE" => cookie)
- res1["Set-Cookie"][session_match].should.equal session
- res1.body.should.equal '{"counter"=>2}'
-
- res2 = rreq.get("/", "HTTP_COOKIE" => cookie)
- new_cookie = res2["Set-Cookie"]
- new_session = new_cookie[session_match]
- new_session.should.not.equal session
- res2.body.should.equal '{"counter"=>3}'
-
- res3 = req.get("/", "HTTP_COOKIE" => new_cookie)
- res3["Set-Cookie"][session_match].should.equal new_session
- res3.body.should.equal '{"counter"=>4}'
- end
-
- specify "omits cookie with :defer option" do
- pool = Rack::Session::Memcache.new(incrementor)
- req = Rack::MockRequest.new(pool)
- defer = Rack::Utils::Context.new(pool, defer_session)
- dreq = Rack::MockRequest.new(defer)
-
- res0 = req.get("/")
- session = (cookie = res0["Set-Cookie"])[session_match]
- res0.body.should.equal '{"counter"=>1}'
-
- res1 = req.get("/", "HTTP_COOKIE" => cookie)
- res1["Set-Cookie"][session_match].should.equal session
- res1.body.should.equal '{"counter"=>2}'
-
- res2 = dreq.get("/", "HTTP_COOKIE" => cookie)
- res2["Set-Cookie"].should.equal nil
- res2.body.should.equal '{"counter"=>3}'
-
- res3 = req.get("/", "HTTP_COOKIE" => cookie)
- res3["Set-Cookie"][session_match].should.equal session
- res3.body.should.equal '{"counter"=>4}'
- end
-
- specify "deep hashes are correctly updated" do
- store = nil
- hash_check = proc do |env|
- session = env['rack.session']
- unless session.include? 'test'
- session.update :a => :b, :c => { :d => :e },
- :f => { :g => { :h => :i} }, 'test' => true
- else
- session[:f][:g][:h] = :j
- end
- [200, {}, session.inspect]
- end
- pool = Rack::Session::Memcache.new(hash_check)
- req = Rack::MockRequest.new(pool)
-
- res0 = req.get("/")
- session_id = (cookie = res0["Set-Cookie"])[session_match, 1]
- ses0 = pool.pool.get(session_id, true)
-
- res1 = req.get("/", "HTTP_COOKIE" => cookie)
- ses1 = pool.pool.get(session_id, true)
-
- ses1.should.not.equal ses0
- end
-
- # anyone know how to do this better?
- specify "multithread: should cleanly merge sessions" do
- next unless $DEBUG
- warn 'Running multithread test for Session::Memcache'
- pool = Rack::Session::Memcache.new(incrementor)
- req = Rack::MockRequest.new(pool)
-
- res = req.get('/')
- res.body.should.equal '{"counter"=>1}'
- cookie = res["Set-Cookie"]
- session_id = cookie[session_match, 1]
-
- delta_incrementor = lambda do |env|
- # emulate disconjoinment of threading
- env['rack.session'] = env['rack.session'].dup
- Thread.stop
- env['rack.session'][(Time.now.usec*rand).to_i] = true
- incrementor.call(env)
- end
- tses = Rack::Utils::Context.new pool, delta_incrementor
- treq = Rack::MockRequest.new(tses)
- tnum = rand(7).to_i+5
- r = Array.new(tnum) do
- Thread.new(treq) do |run|
- run.get('/', "HTTP_COOKIE" => cookie, 'rack.multithread' => true)
- end
- end.reverse.map{|t| t.run.join.value }
- r.each do |request|
- request['Set-Cookie'].should.equal cookie
- request.body.should.include '"counter"=>2'
- end
-
- session = pool.pool.get(session_id)
- session.size.should.be tnum+1 # counter
- session['counter'].should.be 2 # meeeh
-
- tnum = rand(7).to_i+5
- r = Array.new(tnum) do |i|
- delta_time = proc do |env|
- env['rack.session'][i] = Time.now
- Thread.stop
- env['rack.session'] = env['rack.session'].dup
- env['rack.session'][i] -= Time.now
- incrementor.call(env)
- end
- app = Rack::Utils::Context.new pool, time_delta
- req = Rack::MockRequest.new app
- Thread.new(req) do |run|
- run.get('/', "HTTP_COOKIE" => cookie, 'rack.multithread' => true)
- end
- end.reverse.map{|t| t.run.join.value }
- r.each do |request|
- request['Set-Cookie'].should.equal cookie
- request.body.should.include '"counter"=>3'
- end
-
- session = pool.pool.get(session_id)
- session.size.should.be tnum+1
- session['counter'].should.be 3
-
- drop_counter = proc do |env|
- env['rack.session'].delete 'counter'
- env['rack.session']['foo'] = 'bar'
- [200, {'Content-Type'=>'text/plain'}, env['rack.session'].inspect]
- end
- tses = Rack::Utils::Context.new pool, drop_counter
- treq = Rack::MockRequest.new(tses)
- tnum = rand(7).to_i+5
- r = Array.new(tnum) do
- Thread.new(treq) do |run|
- run.get('/', "HTTP_COOKIE" => cookie, 'rack.multithread' => true)
- end
- end.reverse.map{|t| t.run.join.value }
- r.each do |request|
- request['Set-Cookie'].should.equal cookie
- request.body.should.include '"foo"=>"bar"'
- end
-
- session = pool.pool.get(session_id)
- session.size.should.be r.size+1
- session['counter'].should.be.nil?
- session['foo'].should.equal 'bar'
- end
- end
-rescue RuntimeError
- $stderr.puts "Skipping Rack::Session::Memcache tests. Start memcached and try again."
-rescue LoadError
- $stderr.puts "Skipping Rack::Session::Memcache tests (Memcache is required). `gem install memcache-client` and try again."
-end
diff --git a/vendor/gems/rack-1.1.0/test/spec_rack_session_pool.rb b/vendor/gems/rack-1.1.0/test/spec_rack_session_pool.rb
deleted file mode 100644
index 6be382ec..00000000
--- a/vendor/gems/rack-1.1.0/test/spec_rack_session_pool.rb
+++ /dev/null
@@ -1,172 +0,0 @@
-require 'test/spec'
-
-require 'rack/session/pool'
-require 'rack/mock'
-require 'rack/response'
-require 'thread'
-
-context "Rack::Session::Pool" do
- session_key = Rack::Session::Pool::DEFAULT_OPTIONS[:key]
- session_match = /#{session_key}=[0-9a-fA-F]+;/
- incrementor = lambda do |env|
- env["rack.session"]["counter"] ||= 0
- env["rack.session"]["counter"] += 1
- Rack::Response.new(env["rack.session"].inspect).to_a
- end
- drop_session = proc do |env|
- env['rack.session.options'][:drop] = true
- incrementor.call(env)
- end
- renew_session = proc do |env|
- env['rack.session.options'][:renew] = true
- incrementor.call(env)
- end
- defer_session = proc do |env|
- env['rack.session.options'][:defer] = true
- incrementor.call(env)
- end
-
- specify "creates a new cookie" do
- pool = Rack::Session::Pool.new(incrementor)
- res = Rack::MockRequest.new(pool).get("/")
- res["Set-Cookie"].should.match session_match
- res.body.should.equal '{"counter"=>1}'
- end
-
- specify "determines session from a cookie" do
- pool = Rack::Session::Pool.new(incrementor)
- req = Rack::MockRequest.new(pool)
- cookie = req.get("/")["Set-Cookie"]
- req.get("/", "HTTP_COOKIE" => cookie).
- body.should.equal '{"counter"=>2}'
- req.get("/", "HTTP_COOKIE" => cookie).
- body.should.equal '{"counter"=>3}'
- end
-
- specify "survives nonexistant cookies" do
- pool = Rack::Session::Pool.new(incrementor)
- res = Rack::MockRequest.new(pool).
- get("/", "HTTP_COOKIE" => "#{session_key}=blarghfasel")
- res.body.should.equal '{"counter"=>1}'
- end
-
- specify "deletes cookies with :drop option" do
- pool = Rack::Session::Pool.new(incrementor)
- req = Rack::MockRequest.new(pool)
- drop = Rack::Utils::Context.new(pool, drop_session)
- dreq = Rack::MockRequest.new(drop)
-
- res0 = req.get("/")
- session = (cookie = res0["Set-Cookie"])[session_match]
- res0.body.should.equal '{"counter"=>1}'
- pool.pool.size.should.be 1
-
- res1 = req.get("/", "HTTP_COOKIE" => cookie)
- res1["Set-Cookie"][session_match].should.equal session
- res1.body.should.equal '{"counter"=>2}'
- pool.pool.size.should.be 1
-
- res2 = dreq.get("/", "HTTP_COOKIE" => cookie)
- res2["Set-Cookie"].should.equal nil
- res2.body.should.equal '{"counter"=>3}'
- pool.pool.size.should.be 0
-
- res3 = req.get("/", "HTTP_COOKIE" => cookie)
- res3["Set-Cookie"][session_match].should.not.equal session
- res3.body.should.equal '{"counter"=>1}'
- pool.pool.size.should.be 1
- end
-
- specify "provides new session id with :renew option" do
- pool = Rack::Session::Pool.new(incrementor)
- req = Rack::MockRequest.new(pool)
- renew = Rack::Utils::Context.new(pool, renew_session)
- rreq = Rack::MockRequest.new(renew)
-
- res0 = req.get("/")
- session = (cookie = res0["Set-Cookie"])[session_match]
- res0.body.should.equal '{"counter"=>1}'
- pool.pool.size.should.be 1
-
- res1 = req.get("/", "HTTP_COOKIE" => cookie)
- res1["Set-Cookie"][session_match].should.equal session
- res1.body.should.equal '{"counter"=>2}'
- pool.pool.size.should.be 1
-
- res2 = rreq.get("/", "HTTP_COOKIE" => cookie)
- new_cookie = res2["Set-Cookie"]
- new_session = new_cookie[session_match]
- new_session.should.not.equal session
- res2.body.should.equal '{"counter"=>3}'
- pool.pool.size.should.be 1
-
- res3 = req.get("/", "HTTP_COOKIE" => new_cookie)
- res3["Set-Cookie"][session_match].should.equal new_session
- res3.body.should.equal '{"counter"=>4}'
- pool.pool.size.should.be 1
- end
-
- specify "omits cookie with :defer option" do
- pool = Rack::Session::Pool.new(incrementor)
- req = Rack::MockRequest.new(pool)
- defer = Rack::Utils::Context.new(pool, defer_session)
- dreq = Rack::MockRequest.new(defer)
-
- res0 = req.get("/")
- session = (cookie = res0["Set-Cookie"])[session_match]
- res0.body.should.equal '{"counter"=>1}'
- pool.pool.size.should.be 1
-
- res1 = req.get("/", "HTTP_COOKIE" => cookie)
- res1["Set-Cookie"][session_match].should.equal session
- res1.body.should.equal '{"counter"=>2}'
- pool.pool.size.should.be 1
-
- res2 = dreq.get("/", "HTTP_COOKIE" => cookie)
- res2["Set-Cookie"].should.equal nil
- res2.body.should.equal '{"counter"=>3}'
- pool.pool.size.should.be 1
-
- res3 = req.get("/", "HTTP_COOKIE" => cookie)
- res3["Set-Cookie"][session_match].should.equal session
- res3.body.should.equal '{"counter"=>4}'
- pool.pool.size.should.be 1
- end
-
- # anyone know how to do this better?
- specify "multithread: should merge sessions" do
- next unless $DEBUG
- warn 'Running multithread tests for Session::Pool'
- pool = Rack::Session::Pool.new(incrementor)
- req = Rack::MockRequest.new(pool)
-
- res = req.get('/')
- res.body.should.equal '{"counter"=>1}'
- cookie = res["Set-Cookie"]
- sess_id = cookie[/#{pool.key}=([^,;]+)/,1]
-
- delta_incrementor = lambda do |env|
- # emulate disconjoinment of threading
- env['rack.session'] = env['rack.session'].dup
- Thread.stop
- env['rack.session'][(Time.now.usec*rand).to_i] = true
- incrementor.call(env)
- end
- tses = Rack::Utils::Context.new pool, delta_incrementor
- treq = Rack::MockRequest.new(tses)
- tnum = rand(7).to_i+5
- r = Array.new(tnum) do
- Thread.new(treq) do |run|
- run.get('/', "HTTP_COOKIE" => cookie, 'rack.multithread' => true)
- end
- end.reverse.map{|t| t.run.join.value }
- r.each do |res|
- res['Set-Cookie'].should.equal cookie
- res.body.should.include '"counter"=>2'
- end
-
- session = pool.pool[sess_id]
- session.size.should.be tnum+1 # counter
- session['counter'].should.be 2 # meeeh
- end
-end
diff --git a/vendor/gems/rack-1.1.0/test/spec_rack_showexceptions.rb b/vendor/gems/rack-1.1.0/test/spec_rack_showexceptions.rb
deleted file mode 100644
index bdbc1201..00000000
--- a/vendor/gems/rack-1.1.0/test/spec_rack_showexceptions.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-require 'test/spec'
-
-require 'rack/showexceptions'
-require 'rack/mock'
-
-context "Rack::ShowExceptions" do
- specify "catches exceptions" do
- res = nil
- req = Rack::MockRequest.new(Rack::ShowExceptions.new(lambda { |env|
- raise RuntimeError
- }))
- lambda {
- res = req.get("/")
- }.should.not.raise
- res.should.be.a.server_error
- res.status.should.equal 500
-
- res.should =~ /RuntimeError/
- res.should =~ /ShowExceptions/
- end
-end
diff --git a/vendor/gems/rack-1.1.0/test/spec_rack_showstatus.rb b/vendor/gems/rack-1.1.0/test/spec_rack_showstatus.rb
deleted file mode 100644
index 78700134..00000000
--- a/vendor/gems/rack-1.1.0/test/spec_rack_showstatus.rb
+++ /dev/null
@@ -1,72 +0,0 @@
-require 'test/spec'
-
-require 'rack/showstatus'
-require 'rack/mock'
-
-context "Rack::ShowStatus" do
- specify "should provide a default status message" do
- req = Rack::MockRequest.new(Rack::ShowStatus.new(lambda { |env|
- [404, {"Content-Type" => "text/plain", "Content-Length" => "0"}, []]
- }))
-
- res = req.get("/", :lint => true)
- res.should.be.not_found
- res.should.be.not.empty
-
- res["Content-Type"].should.equal("text/html")
- res.should =~ /404/
- res.should =~ /Not Found/
- end
-
- specify "should let the app provide additional information" do
- req = Rack::MockRequest.new(Rack::ShowStatus.new(lambda { |env|
- env["rack.showstatus.detail"] = "gone too meta."
- [404, {"Content-Type" => "text/plain", "Content-Length" => "0"}, []]
- }))
-
- res = req.get("/", :lint => true)
- res.should.be.not_found
- res.should.be.not.empty
-
- res["Content-Type"].should.equal("text/html")
- res.should =~ /404/
- res.should =~ /Not Found/
- res.should =~ /too meta/
- end
-
- specify "should not replace existing messages" do
- req = Rack::MockRequest.new(Rack::ShowStatus.new(lambda { |env|
- [404, {"Content-Type" => "text/plain", "Content-Length" => "4"}, ["foo!"]]
- }))
- res = req.get("/", :lint => true)
- res.should.be.not_found
-
- res.body.should == "foo!"
- end
-
- specify "should pass on original headers" do
- headers = {"WWW-Authenticate" => "Basic blah"}
-
- req = Rack::MockRequest.new(Rack::ShowStatus.new(lambda { |env| [401, headers, []] }))
- res = req.get("/", :lint => true)
-
- res["WWW-Authenticate"].should.equal("Basic blah")
- end
-
- specify "should replace existing messages if there is detail" do
- req = Rack::MockRequest.new(Rack::ShowStatus.new(lambda { |env|
- env["rack.showstatus.detail"] = "gone too meta."
- [404, {"Content-Type" => "text/plain", "Content-Length" => "4"}, ["foo!"]]
- }))
-
- res = req.get("/", :lint => true)
- res.should.be.not_found
- res.should.be.not.empty
-
- res["Content-Type"].should.equal("text/html")
- res["Content-Length"].should.not.equal("4")
- res.should =~ /404/
- res.should =~ /too meta/
- res.body.should.not =~ /foo/
- end
-end
diff --git a/vendor/gems/rack-1.1.0/test/spec_rack_static.rb b/vendor/gems/rack-1.1.0/test/spec_rack_static.rb
deleted file mode 100644
index 19d2ecb7..00000000
--- a/vendor/gems/rack-1.1.0/test/spec_rack_static.rb
+++ /dev/null
@@ -1,37 +0,0 @@
-require 'test/spec'
-
-require 'rack/static'
-require 'rack/mock'
-
-class DummyApp
- def call(env)
- [200, {}, ["Hello World"]]
- end
-end
-
-context "Rack::Static" do
- root = File.expand_path(File.dirname(__FILE__))
- OPTIONS = {:urls => ["/cgi"], :root => root}
-
- setup do
- @request = Rack::MockRequest.new(Rack::Static.new(DummyApp.new, OPTIONS))
- end
-
- specify "serves files" do
- res = @request.get("/cgi/test")
- res.should.be.ok
- res.body.should =~ /ruby/
- end
-
- specify "404s if url root is known but it can't find the file" do
- res = @request.get("/cgi/foo")
- res.should.be.not_found
- end
-
- specify "calls down the chain if url root is not known" do
- res = @request.get("/something/else")
- res.should.be.ok
- res.body.should == "Hello World"
- end
-
-end
diff --git a/vendor/gems/rack-1.1.0/test/spec_rack_thin.rb b/vendor/gems/rack-1.1.0/test/spec_rack_thin.rb
deleted file mode 100644
index 324f6498..00000000
--- a/vendor/gems/rack-1.1.0/test/spec_rack_thin.rb
+++ /dev/null
@@ -1,91 +0,0 @@
-require 'test/spec'
-
-begin
-require 'rack/handler/thin'
-require 'testrequest'
-require 'timeout'
-
-context "Rack::Handler::Thin" do
- include TestRequest::Helpers
-
- setup do
- @app = Rack::Lint.new(TestRequest.new)
- @server = nil
- Thin::Logging.silent = true
- @thread = Thread.new do
- Rack::Handler::Thin.run(@app, :Host => @host='0.0.0.0', :Port => @port=9204) do |server|
- @server = server
- end
- end
- Thread.pass until @server && @server.running?
- end
-
- specify "should respond" do
- lambda {
- GET("/")
- }.should.not.raise
- end
-
- specify "should be a Thin" do
- GET("/")
- status.should.be 200
- response["SERVER_SOFTWARE"].should =~ /thin/
- response["HTTP_VERSION"].should.equal "HTTP/1.1"
- response["SERVER_PROTOCOL"].should.equal "HTTP/1.1"
- response["SERVER_PORT"].should.equal "9204"
- response["SERVER_NAME"].should.equal "0.0.0.0"
- end
-
- specify "should have rack headers" do
- GET("/")
- response["rack.version"].should.equal [0,3]
- response["rack.multithread"].should.be false
- response["rack.multiprocess"].should.be false
- response["rack.run_once"].should.be false
- end
-
- specify "should have CGI headers on GET" do
- GET("/")
- response["REQUEST_METHOD"].should.equal "GET"
- response["REQUEST_PATH"].should.equal "/"
- response["PATH_INFO"].should.be.equal "/"
- response["QUERY_STRING"].should.equal ""
- response["test.postdata"].should.equal ""
-
- GET("/test/foo?quux=1")
- response["REQUEST_METHOD"].should.equal "GET"
- response["REQUEST_PATH"].should.equal "/test/foo"
- response["PATH_INFO"].should.equal "/test/foo"
- response["QUERY_STRING"].should.equal "quux=1"
- end
-
- specify "should have CGI headers on POST" do
- POST("/", {"rack-form-data" => "23"}, {'X-test-header' => '42'})
- status.should.equal 200
- response["REQUEST_METHOD"].should.equal "POST"
- response["REQUEST_PATH"].should.equal "/"
- response["QUERY_STRING"].should.equal ""
- response["HTTP_X_TEST_HEADER"].should.equal "42"
- response["test.postdata"].should.equal "rack-form-data=23"
- end
-
- specify "should support HTTP auth" do
- GET("/test", {:user => "ruth", :passwd => "secret"})
- response["HTTP_AUTHORIZATION"].should.equal "Basic cnV0aDpzZWNyZXQ="
- end
-
- specify "should set status" do
- GET("/test?secret")
- status.should.equal 403
- response["rack.url_scheme"].should.equal "http"
- end
-
- teardown do
- @server.stop!
- @thread.kill
- end
-end
-
-rescue LoadError
- $stderr.puts "Skipping Rack::Handler::Thin tests (Thin is required). `gem install thin` and try again."
-end
diff --git a/vendor/gems/rack-1.1.0/test/spec_rack_urlmap.rb b/vendor/gems/rack-1.1.0/test/spec_rack_urlmap.rb
deleted file mode 100644
index 3d8fe605..00000000
--- a/vendor/gems/rack-1.1.0/test/spec_rack_urlmap.rb
+++ /dev/null
@@ -1,215 +0,0 @@
-require 'test/spec'
-
-require 'rack/urlmap'
-require 'rack/mock'
-
-context "Rack::URLMap" do
- specify "dispatches paths correctly" do
- app = lambda { |env|
- [200, {
- 'X-ScriptName' => env['SCRIPT_NAME'],
- 'X-PathInfo' => env['PATH_INFO'],
- 'Content-Type' => 'text/plain'
- }, [""]]
- }
- map = Rack::URLMap.new({
- 'http://foo.org/bar' => app,
- '/foo' => app,
- '/foo/bar' => app
- })
-
- res = Rack::MockRequest.new(map).get("/")
- res.should.be.not_found
-
- res = Rack::MockRequest.new(map).get("/qux")
- res.should.be.not_found
-
- res = Rack::MockRequest.new(map).get("/foo")
- res.should.be.ok
- res["X-ScriptName"].should.equal "/foo"
- res["X-PathInfo"].should.equal ""
-
- res = Rack::MockRequest.new(map).get("/foo/")
- res.should.be.ok
- res["X-ScriptName"].should.equal "/foo"
- res["X-PathInfo"].should.equal "/"
-
- res = Rack::MockRequest.new(map).get("/foo/bar")
- res.should.be.ok
- res["X-ScriptName"].should.equal "/foo/bar"
- res["X-PathInfo"].should.equal ""
-
- res = Rack::MockRequest.new(map).get("/foo/bar/")
- res.should.be.ok
- res["X-ScriptName"].should.equal "/foo/bar"
- res["X-PathInfo"].should.equal "/"
-
- res = Rack::MockRequest.new(map).get("/foo///bar//quux")
- res.status.should.equal 200
- res.should.be.ok
- res["X-ScriptName"].should.equal "/foo/bar"
- res["X-PathInfo"].should.equal "//quux"
-
- res = Rack::MockRequest.new(map).get("/foo/quux", "SCRIPT_NAME" => "/bleh")
- res.should.be.ok
- res["X-ScriptName"].should.equal "/bleh/foo"
- res["X-PathInfo"].should.equal "/quux"
-
- res = Rack::MockRequest.new(map).get("/bar", 'HTTP_HOST' => 'foo.org')
- res.should.be.ok
- res["X-ScriptName"].should.equal "/bar"
- res["X-PathInfo"].should.be.empty
-
- res = Rack::MockRequest.new(map).get("/bar/", 'HTTP_HOST' => 'foo.org')
- res.should.be.ok
- res["X-ScriptName"].should.equal "/bar"
- res["X-PathInfo"].should.equal '/'
- end
-
-
- specify "dispatches hosts correctly" do
- map = Rack::URLMap.new("http://foo.org/" => lambda { |env|
- [200,
- { "Content-Type" => "text/plain",
- "X-Position" => "foo.org",
- "X-Host" => env["HTTP_HOST"] || env["SERVER_NAME"],
- }, [""]]},
- "http://subdomain.foo.org/" => lambda { |env|
- [200,
- { "Content-Type" => "text/plain",
- "X-Position" => "subdomain.foo.org",
- "X-Host" => env["HTTP_HOST"] || env["SERVER_NAME"],
- }, [""]]},
- "http://bar.org/" => lambda { |env|
- [200,
- { "Content-Type" => "text/plain",
- "X-Position" => "bar.org",
- "X-Host" => env["HTTP_HOST"] || env["SERVER_NAME"],
- }, [""]]},
- "/" => lambda { |env|
- [200,
- { "Content-Type" => "text/plain",
- "X-Position" => "default.org",
- "X-Host" => env["HTTP_HOST"] || env["SERVER_NAME"],
- }, [""]]}
- )
-
- res = Rack::MockRequest.new(map).get("/")
- res.should.be.ok
- res["X-Position"].should.equal "default.org"
-
- res = Rack::MockRequest.new(map).get("/", "HTTP_HOST" => "bar.org")
- res.should.be.ok
- res["X-Position"].should.equal "bar.org"
-
- res = Rack::MockRequest.new(map).get("/", "HTTP_HOST" => "foo.org")
- res.should.be.ok
- res["X-Position"].should.equal "foo.org"
-
- res = Rack::MockRequest.new(map).get("/", "HTTP_HOST" => "subdomain.foo.org", "SERVER_NAME" => "foo.org")
- res.should.be.ok
- res["X-Position"].should.equal "subdomain.foo.org"
-
- res = Rack::MockRequest.new(map).get("http://foo.org/")
- res.should.be.ok
- res["X-Position"].should.equal "default.org"
-
- res = Rack::MockRequest.new(map).get("/", "HTTP_HOST" => "example.org")
- res.should.be.ok
- res["X-Position"].should.equal "default.org"
-
- res = Rack::MockRequest.new(map).get("/",
- "HTTP_HOST" => "example.org:9292",
- "SERVER_PORT" => "9292")
- res.should.be.ok
- res["X-Position"].should.equal "default.org"
- end
-
- specify "should be nestable" do
- map = Rack::URLMap.new("/foo" =>
- Rack::URLMap.new("/bar" =>
- Rack::URLMap.new("/quux" => lambda { |env|
- [200,
- { "Content-Type" => "text/plain",
- "X-Position" => "/foo/bar/quux",
- "X-PathInfo" => env["PATH_INFO"],
- "X-ScriptName" => env["SCRIPT_NAME"],
- }, [""]]}
- )))
-
- res = Rack::MockRequest.new(map).get("/foo/bar")
- res.should.be.not_found
-
- res = Rack::MockRequest.new(map).get("/foo/bar/quux")
- res.should.be.ok
- res["X-Position"].should.equal "/foo/bar/quux"
- res["X-PathInfo"].should.equal ""
- res["X-ScriptName"].should.equal "/foo/bar/quux"
- end
-
- specify "should route root apps correctly" do
- map = Rack::URLMap.new("/" => lambda { |env|
- [200,
- { "Content-Type" => "text/plain",
- "X-Position" => "root",
- "X-PathInfo" => env["PATH_INFO"],
- "X-ScriptName" => env["SCRIPT_NAME"]
- }, [""]]},
- "/foo" => lambda { |env|
- [200,
- { "Content-Type" => "text/plain",
- "X-Position" => "foo",
- "X-PathInfo" => env["PATH_INFO"],
- "X-ScriptName" => env["SCRIPT_NAME"]
- }, [""]]}
- )
-
- res = Rack::MockRequest.new(map).get("/foo/bar")
- res.should.be.ok
- res["X-Position"].should.equal "foo"
- res["X-PathInfo"].should.equal "/bar"
- res["X-ScriptName"].should.equal "/foo"
-
- res = Rack::MockRequest.new(map).get("/foo")
- res.should.be.ok
- res["X-Position"].should.equal "foo"
- res["X-PathInfo"].should.equal ""
- res["X-ScriptName"].should.equal "/foo"
-
- res = Rack::MockRequest.new(map).get("/bar")
- res.should.be.ok
- res["X-Position"].should.equal "root"
- res["X-PathInfo"].should.equal "/bar"
- res["X-ScriptName"].should.equal ""
-
- res = Rack::MockRequest.new(map).get("")
- res.should.be.ok
- res["X-Position"].should.equal "root"
- res["X-PathInfo"].should.equal "/"
- res["X-ScriptName"].should.equal ""
- end
-
- specify "should not squeeze slashes" do
- map = Rack::URLMap.new("/" => lambda { |env|
- [200,
- { "Content-Type" => "text/plain",
- "X-Position" => "root",
- "X-PathInfo" => env["PATH_INFO"],
- "X-ScriptName" => env["SCRIPT_NAME"]
- }, [""]]},
- "/foo" => lambda { |env|
- [200,
- { "Content-Type" => "text/plain",
- "X-Position" => "foo",
- "X-PathInfo" => env["PATH_INFO"],
- "X-ScriptName" => env["SCRIPT_NAME"]
- }, [""]]}
- )
-
- res = Rack::MockRequest.new(map).get("/http://example.org/bar")
- res.should.be.ok
- res["X-Position"].should.equal "root"
- res["X-PathInfo"].should.equal "/http://example.org/bar"
- res["X-ScriptName"].should.equal ""
- end
-end
diff --git a/vendor/gems/rack-1.1.0/test/spec_rack_utils.rb b/vendor/gems/rack-1.1.0/test/spec_rack_utils.rb
deleted file mode 100644
index 269a52bd..00000000
--- a/vendor/gems/rack-1.1.0/test/spec_rack_utils.rb
+++ /dev/null
@@ -1,552 +0,0 @@
-require 'test/spec'
-
-require 'rack/utils'
-require 'rack/lint'
-require 'rack/mock'
-
-context "Rack::Utils" do
- specify "should escape correctly" do
- Rack::Utils.escape("fobar").should.equal "fo%3Co%3Ebar"
- Rack::Utils.escape("a space").should.equal "a+space"
- Rack::Utils.escape("q1!2\"'w$5&7/z8)?\\").
- should.equal "q1%212%22%27w%245%267%2Fz8%29%3F%5C"
- end
-
- specify "should escape correctly for multibyte characters" do
- matz_name = "\xE3\x81\xBE\xE3\x81\xA4\xE3\x82\x82\xE3\x81\xA8".unpack("a*")[0] # Matsumoto
- matz_name.force_encoding("UTF-8") if matz_name.respond_to? :force_encoding
- Rack::Utils.escape(matz_name).should.equal '%E3%81%BE%E3%81%A4%E3%82%82%E3%81%A8'
- matz_name_sep = "\xE3\x81\xBE\xE3\x81\xA4 \xE3\x82\x82\xE3\x81\xA8".unpack("a*")[0] # Matsu moto
- matz_name_sep.force_encoding("UTF-8") if matz_name_sep.respond_to? :force_encoding
- Rack::Utils.escape(matz_name_sep).should.equal '%E3%81%BE%E3%81%A4+%E3%82%82%E3%81%A8'
- end
-
- specify "should unescape correctly" do
- Rack::Utils.unescape("fo%3Co%3Ebar").should.equal "fobar"
- Rack::Utils.unescape("a+space").should.equal "a space"
- Rack::Utils.unescape("a%20space").should.equal "a space"
- Rack::Utils.unescape("q1%212%22%27w%245%267%2Fz8%29%3F%5C").
- should.equal "q1!2\"'w$5&7/z8)?\\"
- end
-
- specify "should parse query strings correctly" do
- Rack::Utils.parse_query("foo=bar").
- should.equal "foo" => "bar"
- Rack::Utils.parse_query("foo=\"bar\"").
- should.equal "foo" => "bar"
- Rack::Utils.parse_query("foo=bar&foo=quux").
- should.equal "foo" => ["bar", "quux"]
- Rack::Utils.parse_query("foo=1&bar=2").
- should.equal "foo" => "1", "bar" => "2"
- Rack::Utils.parse_query("my+weird+field=q1%212%22%27w%245%267%2Fz8%29%3F").
- should.equal "my weird field" => "q1!2\"'w$5&7/z8)?"
- Rack::Utils.parse_query("foo%3Dbaz=bar").should.equal "foo=baz" => "bar"
- end
-
- specify "should parse nested query strings correctly" do
- Rack::Utils.parse_nested_query("foo").
- should.equal "foo" => nil
- Rack::Utils.parse_nested_query("foo=").
- should.equal "foo" => ""
- Rack::Utils.parse_nested_query("foo=bar").
- should.equal "foo" => "bar"
- Rack::Utils.parse_nested_query("foo=\"bar\"").
- should.equal "foo" => "bar"
-
- Rack::Utils.parse_nested_query("foo=bar&foo=quux").
- should.equal "foo" => "quux"
- Rack::Utils.parse_nested_query("foo&foo=").
- should.equal "foo" => ""
- Rack::Utils.parse_nested_query("foo=1&bar=2").
- should.equal "foo" => "1", "bar" => "2"
- Rack::Utils.parse_nested_query("&foo=1&&bar=2").
- should.equal "foo" => "1", "bar" => "2"
- Rack::Utils.parse_nested_query("foo&bar=").
- should.equal "foo" => nil, "bar" => ""
- Rack::Utils.parse_nested_query("foo=bar&baz=").
- should.equal "foo" => "bar", "baz" => ""
- Rack::Utils.parse_nested_query("my+weird+field=q1%212%22%27w%245%267%2Fz8%29%3F").
- should.equal "my weird field" => "q1!2\"'w$5&7/z8)?"
-
- Rack::Utils.parse_nested_query("foo[]").
- should.equal "foo" => [nil]
- Rack::Utils.parse_nested_query("foo[]=").
- should.equal "foo" => [""]
- Rack::Utils.parse_nested_query("foo[]=bar").
- should.equal "foo" => ["bar"]
-
- Rack::Utils.parse_nested_query("foo[]=1&foo[]=2").
- should.equal "foo" => ["1", "2"]
- Rack::Utils.parse_nested_query("foo=bar&baz[]=1&baz[]=2&baz[]=3").
- should.equal "foo" => "bar", "baz" => ["1", "2", "3"]
- Rack::Utils.parse_nested_query("foo[]=bar&baz[]=1&baz[]=2&baz[]=3").
- should.equal "foo" => ["bar"], "baz" => ["1", "2", "3"]
-
- Rack::Utils.parse_nested_query("x[y][z]=1").
- should.equal "x" => {"y" => {"z" => "1"}}
- Rack::Utils.parse_nested_query("x[y][z][]=1").
- should.equal "x" => {"y" => {"z" => ["1"]}}
- Rack::Utils.parse_nested_query("x[y][z]=1&x[y][z]=2").
- should.equal "x" => {"y" => {"z" => "2"}}
- Rack::Utils.parse_nested_query("x[y][z][]=1&x[y][z][]=2").
- should.equal "x" => {"y" => {"z" => ["1", "2"]}}
-
- Rack::Utils.parse_nested_query("x[y][][z]=1").
- should.equal "x" => {"y" => [{"z" => "1"}]}
- Rack::Utils.parse_nested_query("x[y][][z][]=1").
- should.equal "x" => {"y" => [{"z" => ["1"]}]}
- Rack::Utils.parse_nested_query("x[y][][z]=1&x[y][][w]=2").
- should.equal "x" => {"y" => [{"z" => "1", "w" => "2"}]}
-
- Rack::Utils.parse_nested_query("x[y][][v][w]=1").
- should.equal "x" => {"y" => [{"v" => {"w" => "1"}}]}
- Rack::Utils.parse_nested_query("x[y][][z]=1&x[y][][v][w]=2").
- should.equal "x" => {"y" => [{"z" => "1", "v" => {"w" => "2"}}]}
-
- Rack::Utils.parse_nested_query("x[y][][z]=1&x[y][][z]=2").
- should.equal "x" => {"y" => [{"z" => "1"}, {"z" => "2"}]}
- Rack::Utils.parse_nested_query("x[y][][z]=1&x[y][][w]=a&x[y][][z]=2&x[y][][w]=3").
- should.equal "x" => {"y" => [{"z" => "1", "w" => "a"}, {"z" => "2", "w" => "3"}]}
-
- lambda { Rack::Utils.parse_nested_query("x[y]=1&x[y]z=2") }.
- should.raise(TypeError).
- message.should.equal "expected Hash (got String) for param `y'"
-
- lambda { Rack::Utils.parse_nested_query("x[y]=1&x[]=1") }.
- should.raise(TypeError).
- message.should.equal "expected Array (got Hash) for param `x'"
-
- lambda { Rack::Utils.parse_nested_query("x[y]=1&x[y][][w]=2") }.
- should.raise(TypeError).
- message.should.equal "expected Array (got String) for param `y'"
- end
-
- specify "should build query strings correctly" do
- Rack::Utils.build_query("foo" => "bar").should.equal "foo=bar"
- Rack::Utils.build_query("foo" => ["bar", "quux"]).
- should.equal "foo=bar&foo=quux"
- Rack::Utils.build_query("foo" => "1", "bar" => "2").
- should.equal "foo=1&bar=2"
- Rack::Utils.build_query("my weird field" => "q1!2\"'w$5&7/z8)?").
- should.equal "my+weird+field=q1%212%22%27w%245%267%2Fz8%29%3F"
- end
-
- specify "should build nested query strings correctly" do
- Rack::Utils.build_nested_query("foo" => nil).should.equal "foo"
- Rack::Utils.build_nested_query("foo" => "").should.equal "foo="
- Rack::Utils.build_nested_query("foo" => "bar").should.equal "foo=bar"
-
- Rack::Utils.build_nested_query("foo" => "1", "bar" => "2").
- should.equal "foo=1&bar=2"
- Rack::Utils.build_nested_query("my weird field" => "q1!2\"'w$5&7/z8)?").
- should.equal "my+weird+field=q1%212%22%27w%245%267%2Fz8%29%3F"
-
- Rack::Utils.build_nested_query("foo" => [nil]).
- should.equal "foo[]"
- Rack::Utils.build_nested_query("foo" => [""]).
- should.equal "foo[]="
- Rack::Utils.build_nested_query("foo" => ["bar"]).
- should.equal "foo[]=bar"
-
- # The ordering of the output query string is unpredictable with 1.8's
- # unordered hash. Test that build_nested_query performs the inverse
- # function of parse_nested_query.
- [{"foo" => nil, "bar" => ""},
- {"foo" => "bar", "baz" => ""},
- {"foo" => ["1", "2"]},
- {"foo" => "bar", "baz" => ["1", "2", "3"]},
- {"foo" => ["bar"], "baz" => ["1", "2", "3"]},
- {"foo" => ["1", "2"]},
- {"foo" => "bar", "baz" => ["1", "2", "3"]},
- {"x" => {"y" => {"z" => "1"}}},
- {"x" => {"y" => {"z" => ["1"]}}},
- {"x" => {"y" => {"z" => ["1", "2"]}}},
- {"x" => {"y" => [{"z" => "1"}]}},
- {"x" => {"y" => [{"z" => ["1"]}]}},
- {"x" => {"y" => [{"z" => "1", "w" => "2"}]}},
- {"x" => {"y" => [{"v" => {"w" => "1"}}]}},
- {"x" => {"y" => [{"z" => "1", "v" => {"w" => "2"}}]}},
- {"x" => {"y" => [{"z" => "1"}, {"z" => "2"}]}},
- {"x" => {"y" => [{"z" => "1", "w" => "a"}, {"z" => "2", "w" => "3"}]}}
- ].each { |params|
- qs = Rack::Utils.build_nested_query(params)
- Rack::Utils.parse_nested_query(qs).should.equal params
- }
-
- lambda { Rack::Utils.build_nested_query("foo=bar") }.
- should.raise(ArgumentError).
- message.should.equal "value must be a Hash"
- end
-
- specify "should figure out which encodings are acceptable" do
- helper = lambda do |a, b|
- request = Rack::Request.new(Rack::MockRequest.env_for("", "HTTP_ACCEPT_ENCODING" => a))
- Rack::Utils.select_best_encoding(a, b)
- end
-
- helper.call(%w(), [["x", 1]]).should.equal(nil)
- helper.call(%w(identity), [["identity", 0.0]]).should.equal(nil)
- helper.call(%w(identity), [["*", 0.0]]).should.equal(nil)
-
- helper.call(%w(identity), [["compress", 1.0], ["gzip", 1.0]]).should.equal("identity")
-
- helper.call(%w(compress gzip identity), [["compress", 1.0], ["gzip", 1.0]]).should.equal("compress")
- helper.call(%w(compress gzip identity), [["compress", 0.5], ["gzip", 1.0]]).should.equal("gzip")
-
- helper.call(%w(foo bar identity), []).should.equal("identity")
- helper.call(%w(foo bar identity), [["*", 1.0]]).should.equal("foo")
- helper.call(%w(foo bar identity), [["*", 1.0], ["foo", 0.9]]).should.equal("bar")
-
- helper.call(%w(foo bar identity), [["foo", 0], ["bar", 0]]).should.equal("identity")
- helper.call(%w(foo bar baz identity), [["*", 0], ["identity", 0.1]]).should.equal("identity")
- end
-
- specify "should return the bytesize of String" do
- Rack::Utils.bytesize("FOO\xE2\x82\xAC").should.equal 6
- end
-
- specify "should return status code for integer" do
- Rack::Utils.status_code(200).should.equal 200
- end
-
- specify "should return status code for string" do
- Rack::Utils.status_code("200").should.equal 200
- end
-
- specify "should return status code for symbol" do
- Rack::Utils.status_code(:ok).should.equal 200
- end
-end
-
-context "Rack::Utils::HeaderHash" do
- specify "should retain header case" do
- h = Rack::Utils::HeaderHash.new("Content-MD5" => "d5ff4e2a0 ...")
- h['ETag'] = 'Boo!'
- h.to_hash.should.equal "Content-MD5" => "d5ff4e2a0 ...", "ETag" => 'Boo!'
- end
-
- specify "should check existence of keys case insensitively" do
- h = Rack::Utils::HeaderHash.new("Content-MD5" => "d5ff4e2a0 ...")
- h.should.include 'content-md5'
- h.should.not.include 'ETag'
- end
-
- specify "should merge case-insensitively" do
- h = Rack::Utils::HeaderHash.new("ETag" => 'HELLO', "content-length" => '123')
- merged = h.merge("Etag" => 'WORLD', 'Content-Length' => '321', "Foo" => 'BAR')
- merged.should.equal "Etag"=>'WORLD', "Content-Length"=>'321', "Foo"=>'BAR'
- end
-
- specify "should overwrite case insensitively and assume the new key's case" do
- h = Rack::Utils::HeaderHash.new("Foo-Bar" => "baz")
- h["foo-bar"] = "bizzle"
- h["FOO-BAR"].should.equal "bizzle"
- h.length.should.equal 1
- h.to_hash.should.equal "foo-bar" => "bizzle"
- end
-
- specify "should be converted to real Hash" do
- h = Rack::Utils::HeaderHash.new("foo" => "bar")
- h.to_hash.should.be.instance_of Hash
- end
-
- specify "should convert Array values to Strings when converting to Hash" do
- h = Rack::Utils::HeaderHash.new("foo" => ["bar", "baz"])
- h.to_hash.should.equal({ "foo" => "bar\nbaz" })
- end
-
- specify "should replace hashes correctly" do
- h = Rack::Utils::HeaderHash.new("Foo-Bar" => "baz")
- j = {"foo" => "bar"}
- h.replace(j)
- h["foo"].should.equal "bar"
- end
-
- specify "should be able to delete the given key case-sensitively" do
- h = Rack::Utils::HeaderHash.new("foo" => "bar")
- h.delete("foo")
- h["foo"].should.be.nil
- h["FOO"].should.be.nil
- end
-
- specify "should be able to delete the given key case-insensitively" do
- h = Rack::Utils::HeaderHash.new("foo" => "bar")
- h.delete("FOO")
- h["foo"].should.be.nil
- h["FOO"].should.be.nil
- end
-
- specify "should return the deleted value when #delete is called on an existing key" do
- h = Rack::Utils::HeaderHash.new("foo" => "bar")
- h.delete("Foo").should.equal("bar")
- end
-
- specify "should return nil when #delete is called on a non-existant key" do
- h = Rack::Utils::HeaderHash.new("foo" => "bar")
- h.delete("Hello").should.be.nil
- end
-
- specify "should avoid unnecessary object creation if possible" do
- a = Rack::Utils::HeaderHash.new("foo" => "bar")
- b = Rack::Utils::HeaderHash.new(a)
- b.object_id.should.equal(a.object_id)
- b.should.equal(a)
- end
-
- specify "should convert Array values to Strings when responding to #each" do
- h = Rack::Utils::HeaderHash.new("foo" => ["bar", "baz"])
- h.each do |k,v|
- k.should.equal("foo")
- v.should.equal("bar\nbaz")
- end
- end
-
-end
-
-context "Rack::Utils::Context" do
- class ContextTest
- attr_reader :app
- def initialize app; @app=app; end
- def call env; context env; end
- def context env, app=@app; app.call(env); end
- end
- test_target1 = proc{|e| e.to_s+' world' }
- test_target2 = proc{|e| e.to_i+2 }
- test_target3 = proc{|e| nil }
- test_target4 = proc{|e| [200,{'Content-Type'=>'text/plain', 'Content-Length'=>'0'},['']] }
- test_app = ContextTest.new test_target4
-
- specify "should set context correctly" do
- test_app.app.should.equal test_target4
- c1 = Rack::Utils::Context.new(test_app, test_target1)
- c1.for.should.equal test_app
- c1.app.should.equal test_target1
- c2 = Rack::Utils::Context.new(test_app, test_target2)
- c2.for.should.equal test_app
- c2.app.should.equal test_target2
- end
-
- specify "should alter app on recontexting" do
- c1 = Rack::Utils::Context.new(test_app, test_target1)
- c2 = c1.recontext(test_target2)
- c2.for.should.equal test_app
- c2.app.should.equal test_target2
- c3 = c2.recontext(test_target3)
- c3.for.should.equal test_app
- c3.app.should.equal test_target3
- end
-
- specify "should run different apps" do
- c1 = Rack::Utils::Context.new test_app, test_target1
- c2 = c1.recontext test_target2
- c3 = c2.recontext test_target3
- c4 = c3.recontext test_target4
- a4 = Rack::Lint.new c4
- a5 = Rack::Lint.new test_app
- r1 = c1.call('hello')
- r1.should.equal 'hello world'
- r2 = c2.call(2)
- r2.should.equal 4
- r3 = c3.call(:misc_symbol)
- r3.should.be.nil
- r4 = Rack::MockRequest.new(a4).get('/')
- r4.status.should.be 200
- r5 = Rack::MockRequest.new(a5).get('/')
- r5.status.should.be 200
- r4.body.should.equal r5.body
- end
-end
-
-context "Rack::Utils::Multipart" do
- specify "should return nil if content type is not multipart" do
- env = Rack::MockRequest.env_for("/",
- "CONTENT_TYPE" => 'application/x-www-form-urlencoded')
- Rack::Utils::Multipart.parse_multipart(env).should.equal nil
- end
-
- specify "should parse multipart upload with text file" do
- env = Rack::MockRequest.env_for("/", multipart_fixture(:text))
- params = Rack::Utils::Multipart.parse_multipart(env)
- params["submit-name"].should.equal "Larry"
- params["files"][:type].should.equal "text/plain"
- params["files"][:filename].should.equal "file1.txt"
- params["files"][:head].should.equal "Content-Disposition: form-data; " +
- "name=\"files\"; filename=\"file1.txt\"\r\n" +
- "Content-Type: text/plain\r\n"
- params["files"][:name].should.equal "files"
- params["files"][:tempfile].read.should.equal "contents"
- end
-
- specify "should parse multipart upload with nested parameters" do
- env = Rack::MockRequest.env_for("/", multipart_fixture(:nested))
- params = Rack::Utils::Multipart.parse_multipart(env)
- params["foo"]["submit-name"].should.equal "Larry"
- params["foo"]["files"][:type].should.equal "text/plain"
- params["foo"]["files"][:filename].should.equal "file1.txt"
- params["foo"]["files"][:head].should.equal "Content-Disposition: form-data; " +
- "name=\"foo[files]\"; filename=\"file1.txt\"\r\n" +
- "Content-Type: text/plain\r\n"
- params["foo"]["files"][:name].should.equal "foo[files]"
- params["foo"]["files"][:tempfile].read.should.equal "contents"
- end
-
- specify "should parse multipart upload with binary file" do
- env = Rack::MockRequest.env_for("/", multipart_fixture(:binary))
- params = Rack::Utils::Multipart.parse_multipart(env)
- params["submit-name"].should.equal "Larry"
- params["files"][:type].should.equal "image/png"
- params["files"][:filename].should.equal "rack-logo.png"
- params["files"][:head].should.equal "Content-Disposition: form-data; " +
- "name=\"files\"; filename=\"rack-logo.png\"\r\n" +
- "Content-Type: image/png\r\n"
- params["files"][:name].should.equal "files"
- params["files"][:tempfile].read.length.should.equal 26473
- end
-
- specify "should parse multipart upload with empty file" do
- env = Rack::MockRequest.env_for("/", multipart_fixture(:empty))
- params = Rack::Utils::Multipart.parse_multipart(env)
- params["submit-name"].should.equal "Larry"
- params["files"][:type].should.equal "text/plain"
- params["files"][:filename].should.equal "file1.txt"
- params["files"][:head].should.equal "Content-Disposition: form-data; " +
- "name=\"files\"; filename=\"file1.txt\"\r\n" +
- "Content-Type: text/plain\r\n"
- params["files"][:name].should.equal "files"
- params["files"][:tempfile].read.should.equal ""
- end
-
- specify "should parse multipart upload with filename with semicolons" do
- env = Rack::MockRequest.env_for("/", multipart_fixture(:semicolon))
- params = Rack::Utils::Multipart.parse_multipart(env)
- params["files"][:type].should.equal "text/plain"
- params["files"][:filename].should.equal "fi;le1.txt"
- params["files"][:head].should.equal "Content-Disposition: form-data; " +
- "name=\"files\"; filename=\"fi;le1.txt\"\r\n" +
- "Content-Type: text/plain\r\n"
- params["files"][:name].should.equal "files"
- params["files"][:tempfile].read.should.equal "contents"
- end
-
- specify "should not include file params if no file was selected" do
- env = Rack::MockRequest.env_for("/", multipart_fixture(:none))
- params = Rack::Utils::Multipart.parse_multipart(env)
- params["submit-name"].should.equal "Larry"
- params["files"].should.equal nil
- params.keys.should.not.include "files"
- end
-
- specify "should parse IE multipart upload and clean up filename" do
- env = Rack::MockRequest.env_for("/", multipart_fixture(:ie))
- params = Rack::Utils::Multipart.parse_multipart(env)
- params["files"][:type].should.equal "text/plain"
- params["files"][:filename].should.equal "file1.txt"
- params["files"][:head].should.equal "Content-Disposition: form-data; " +
- "name=\"files\"; " +
- 'filename="C:\Documents and Settings\Administrator\Desktop\file1.txt"' +
- "\r\nContent-Type: text/plain\r\n"
- params["files"][:name].should.equal "files"
- params["files"][:tempfile].read.should.equal "contents"
- end
-
- specify "rewinds input after parsing upload" do
- options = multipart_fixture(:text)
- input = options[:input]
- env = Rack::MockRequest.env_for("/", options)
- params = Rack::Utils::Multipart.parse_multipart(env)
- params["submit-name"].should.equal "Larry"
- params["files"][:filename].should.equal "file1.txt"
- input.read.length.should.equal 197
- end
-
- specify "builds multipart body" do
- files = Rack::Utils::Multipart::UploadedFile.new(multipart_file("file1.txt"))
- data = Rack::Utils::Multipart.build_multipart("submit-name" => "Larry", "files" => files)
-
- options = {
- "CONTENT_TYPE" => "multipart/form-data; boundary=AaB03x",
- "CONTENT_LENGTH" => data.length.to_s,
- :input => StringIO.new(data)
- }
- env = Rack::MockRequest.env_for("/", options)
- params = Rack::Utils::Multipart.parse_multipart(env)
- params["submit-name"].should.equal "Larry"
- params["files"][:filename].should.equal "file1.txt"
- params["files"][:tempfile].read.should.equal "contents"
- end
-
- specify "builds nested multipart body" do
- files = Rack::Utils::Multipart::UploadedFile.new(multipart_file("file1.txt"))
- data = Rack::Utils::Multipart.build_multipart("people" => [{"submit-name" => "Larry", "files" => files}])
-
- options = {
- "CONTENT_TYPE" => "multipart/form-data; boundary=AaB03x",
- "CONTENT_LENGTH" => data.length.to_s,
- :input => StringIO.new(data)
- }
- env = Rack::MockRequest.env_for("/", options)
- params = Rack::Utils::Multipart.parse_multipart(env)
- params["people"][0]["submit-name"].should.equal "Larry"
- params["people"][0]["files"][:filename].should.equal "file1.txt"
- params["people"][0]["files"][:tempfile].read.should.equal "contents"
- end
-
- specify "can parse fields that end at the end of the buffer" do
- input = File.read(multipart_file("bad_robots"))
-
- req = Rack::Request.new Rack::MockRequest.env_for("/",
- "CONTENT_TYPE" => "multipart/form-data, boundary=1yy3laWhgX31qpiHinh67wJXqKalukEUTvqTzmon",
- "CONTENT_LENGTH" => input.size,
- :input => input)
-
- req.POST['file.path'].should.equal "/var/tmp/uploads/4/0001728414"
- req.POST['addresses'].should.not.equal nil
- end
-
- specify "builds complete params with the chunk size of 16384 slicing exactly on boundary" do
- data = File.open(multipart_file("fail_16384_nofile")) { |f| f.read }.gsub(/\n/, "\r\n")
- options = {
- "CONTENT_TYPE" => "multipart/form-data; boundary=----WebKitFormBoundaryWsY0GnpbI5U7ztzo",
- "CONTENT_LENGTH" => data.length.to_s,
- :input => StringIO.new(data)
- }
- env = Rack::MockRequest.env_for("/", options)
- params = Rack::Utils::Multipart.parse_multipart(env)
-
- params.should.not.equal nil
- params.keys.should.include "AAAAAAAAAAAAAAAAAAA"
- params["AAAAAAAAAAAAAAAAAAA"].keys.should.include "PLAPLAPLA_MEMMEMMEMM_ATTRATTRER"
- params["AAAAAAAAAAAAAAAAAAA"]["PLAPLAPLA_MEMMEMMEMM_ATTRATTRER"].keys.should.include "new"
- params["AAAAAAAAAAAAAAAAAAA"]["PLAPLAPLA_MEMMEMMEMM_ATTRATTRER"]["new"].keys.should.include "-2"
- params["AAAAAAAAAAAAAAAAAAA"]["PLAPLAPLA_MEMMEMMEMM_ATTRATTRER"]["new"]["-2"].keys.should.include "ba_unit_id"
- params["AAAAAAAAAAAAAAAAAAA"]["PLAPLAPLA_MEMMEMMEMM_ATTRATTRER"]["new"]["-2"]["ba_unit_id"].should.equal "1017"
- end
-
- specify "should return nil if no UploadedFiles were used" do
- data = Rack::Utils::Multipart.build_multipart("people" => [{"submit-name" => "Larry", "files" => "contents"}])
- data.should.equal nil
- end
-
- specify "should raise ArgumentError if params is not a Hash" do
- lambda { Rack::Utils::Multipart.build_multipart("foo=bar") }.
- should.raise(ArgumentError).
- message.should.equal "value must be a Hash"
- end
-
- private
- def multipart_fixture(name)
- file = multipart_file(name)
- data = File.open(file, 'rb') { |io| io.read }
-
- type = "multipart/form-data; boundary=AaB03x"
- length = data.respond_to?(:bytesize) ? data.bytesize : data.size
-
- { "CONTENT_TYPE" => type,
- "CONTENT_LENGTH" => length.to_s,
- :input => StringIO.new(data) }
- end
-
- def multipart_file(name)
- File.join(File.dirname(__FILE__), "multipart", name.to_s)
- end
-end
diff --git a/vendor/gems/rack-1.1.0/test/spec_rack_webrick.rb b/vendor/gems/rack-1.1.0/test/spec_rack_webrick.rb
deleted file mode 100644
index 599425c4..00000000
--- a/vendor/gems/rack-1.1.0/test/spec_rack_webrick.rb
+++ /dev/null
@@ -1,130 +0,0 @@
-require 'test/spec'
-
-require 'rack/handler/webrick'
-require 'rack/lint'
-require 'rack/response'
-require 'testrequest'
-
-Thread.abort_on_exception = true
-
-context "Rack::Handler::WEBrick" do
- include TestRequest::Helpers
-
- setup do
- @server = WEBrick::HTTPServer.new(:Host => @host='0.0.0.0',
- :Port => @port=9202,
- :Logger => WEBrick::Log.new(nil, WEBrick::BasicLog::WARN),
- :AccessLog => [])
- @server.mount "/test", Rack::Handler::WEBrick,
- Rack::Lint.new(TestRequest.new)
- Thread.new { @server.start }
- trap(:INT) { @server.shutdown }
- end
-
- specify "should respond" do
- lambda {
- GET("/test")
- }.should.not.raise
- end
-
- specify "should be a WEBrick" do
- GET("/test")
- status.should.be 200
- response["SERVER_SOFTWARE"].should =~ /WEBrick/
- response["HTTP_VERSION"].should.equal "HTTP/1.1"
- response["SERVER_PROTOCOL"].should.equal "HTTP/1.1"
- response["SERVER_PORT"].should.equal "9202"
- response["SERVER_NAME"].should.equal "0.0.0.0"
- end
-
- specify "should have rack headers" do
- GET("/test")
- response["rack.version"].should.equal [1,1]
- response["rack.multithread"].should.be true
- response["rack.multiprocess"].should.be false
- response["rack.run_once"].should.be false
- end
-
- specify "should have CGI headers on GET" do
- GET("/test")
- response["REQUEST_METHOD"].should.equal "GET"
- response["SCRIPT_NAME"].should.equal "/test"
- response["REQUEST_PATH"].should.equal "/"
- response["PATH_INFO"].should.be.equal ""
- response["QUERY_STRING"].should.equal ""
- response["test.postdata"].should.equal ""
-
- GET("/test/foo?quux=1")
- response["REQUEST_METHOD"].should.equal "GET"
- response["SCRIPT_NAME"].should.equal "/test"
- response["REQUEST_PATH"].should.equal "/"
- response["PATH_INFO"].should.equal "/foo"
- response["QUERY_STRING"].should.equal "quux=1"
-
- GET("/test/foo%25encoding?quux=1")
- response["REQUEST_METHOD"].should.equal "GET"
- response["SCRIPT_NAME"].should.equal "/test"
- response["REQUEST_PATH"].should.equal "/"
- response["PATH_INFO"].should.equal "/foo%25encoding"
- response["QUERY_STRING"].should.equal "quux=1"
- end
-
- specify "should have CGI headers on POST" do
- POST("/test", {"rack-form-data" => "23"}, {'X-test-header' => '42'})
- status.should.equal 200
- response["REQUEST_METHOD"].should.equal "POST"
- response["SCRIPT_NAME"].should.equal "/test"
- response["REQUEST_PATH"].should.equal "/"
- response["QUERY_STRING"].should.equal ""
- response["HTTP_X_TEST_HEADER"].should.equal "42"
- response["test.postdata"].should.equal "rack-form-data=23"
- end
-
- specify "should support HTTP auth" do
- GET("/test", {:user => "ruth", :passwd => "secret"})
- response["HTTP_AUTHORIZATION"].should.equal "Basic cnV0aDpzZWNyZXQ="
- end
-
- specify "should set status" do
- GET("/test?secret")
- status.should.equal 403
- response["rack.url_scheme"].should.equal "http"
- end
-
- specify "should correctly set cookies" do
- @server.mount "/cookie-test", Rack::Handler::WEBrick,
- Rack::Lint.new(lambda { |req|
- res = Rack::Response.new
- res.set_cookie "one", "1"
- res.set_cookie "two", "2"
- res.finish
- })
-
- Net::HTTP.start(@host, @port) { |http|
- res = http.get("/cookie-test")
- res.code.to_i.should.equal 200
- res.get_fields("set-cookie").should.equal ["one=1", "two=2"]
- }
- end
-
- specify "should provide a .run" do
- block_ran = false
- catch(:done) {
- Rack::Handler::WEBrick.run(lambda {},
- {:Port => 9210,
- :Logger => WEBrick::Log.new(nil, WEBrick::BasicLog::WARN),
- :AccessLog => []}) { |server|
- block_ran = true
- server.should.be.kind_of WEBrick::HTTPServer
- @s = server
- throw :done
- }
- }
- block_ran.should.be true
- @s.shutdown
- end
-
- teardown do
- @server.shutdown
- end
-end
diff --git a/vendor/gems/rack-1.1.0/test/spec_rackup.rb b/vendor/gems/rack-1.1.0/test/spec_rackup.rb
deleted file mode 100644
index d9926fda..00000000
--- a/vendor/gems/rack-1.1.0/test/spec_rackup.rb
+++ /dev/null
@@ -1,154 +0,0 @@
-require 'test/spec'
-require 'testrequest'
-require 'rack/server'
-require 'open3'
-
-begin
-require "mongrel"
-
-context "rackup" do
- include TestRequest::Helpers
-
- def run_rackup(*args)
- options = args.last.is_a?(Hash) ? args.pop : {}
- flags = args.first
- @host = options[:host] || "0.0.0.0"
- @port = options[:port] || 9292
-
- Dir.chdir("#{root}/test/rackup") do
- @in, @rackup, @err = Open3.popen3("#{Gem.ruby} -S #{rackup} #{flags}")
- end
-
- return if options[:port] == false
-
- # Wait until the server is available
- begin
- GET("/")
- rescue
- sleep 0.05
- retry
- end
- end
-
- def output
- @rackup.read
- end
-
- after do
- # This doesn't actually return a response, so we rescue
- GET "/die" rescue nil
-
- Dir["#{root}/**/*.pid"].each do |file|
- File.delete(file)
- end
-
- File.delete("#{root}/log_output") if File.exist?("#{root}/log_output")
- end
-
- specify "rackup" do
- run_rackup
- response["PATH_INFO"].should.equal '/'
- response["test.$DEBUG"].should.be false
- response["test.$EVAL"].should.be nil
- response["test.$VERBOSE"].should.be false
- response["test.Ping"].should.be nil
- response["SERVER_SOFTWARE"].should.not =~ /webrick/
- end
-
- specify "rackup --help" do
- run_rackup "--help", :port => false
- output.should.match /--port/
- end
-
- specify "rackup --port" do
- run_rackup "--port 9000", :port => 9000
- response["SERVER_PORT"].should.equal "9000"
- end
-
- specify "rackup --debug" do
- run_rackup "--debug"
- response["test.$DEBUG"].should.be true
- end
-
- specify "rackup --eval" do
- run_rackup %{--eval "BUKKIT = 'BUKKIT'"}
- response["test.$EVAL"].should.equal "BUKKIT"
- end
-
- specify "rackup --warn" do
- run_rackup %{--warn}
- response["test.$VERBOSE"].should.be true
- end
-
- specify "rackup --include" do
- run_rackup %{--include /foo/bar}
- response["test.$LOAD_PATH"].should.include "/foo/bar"
- end
-
- specify "rackup --require" do
- run_rackup %{--require ping}
- response["test.Ping"].should.equal "constant"
- end
-
- specify "rackup --server" do
- run_rackup %{--server webrick}
- response["SERVER_SOFTWARE"].should =~ /webrick/i
- end
-
- specify "rackup --host" do
- run_rackup %{--host 127.0.0.1}, :host => "127.0.0.1"
- response["REMOTE_ADDR"].should.equal "127.0.0.1"
- end
-
- specify "rackup --daemonize --pid" do
- run_rackup %{--daemonize --pid testing.pid}
- status.should.be 200
- @rackup.should.be.eof?
- Dir["#{root}/**/testing.pid"].should.not.be.empty?
- end
-
- specify "rackup --pid" do
- run_rackup %{--pid testing.pid}
- status.should.be 200
- Dir["#{root}/**/testing.pid"].should.not.be.empty?
- end
-
- specify "rackup --version" do
- run_rackup %{--version}, :port => false
- output.should =~ /1.0/
- end
-
- specify "rackup --env development includes lint" do
- run_rackup
- GET("/broken_lint")
- status.should.be 500
- end
-
- specify "rackup --env deployment does not include lint" do
- run_rackup %{--env deployment}
- GET("/broken_lint")
- status.should.be 200
- end
-
- specify "rackup --env none does not include lint" do
- run_rackup %{--env none}
- GET("/broken_lint")
- status.should.be 200
- end
-
- specify "rackup --env deployment does log" do
- run_rackup %{--env deployment}
- log = File.read(response["test.stderr"])
- log.should.be.empty?
- end
-
- specify "rackup --env none does not log" do
- run_rackup %{--env none}
- GET("/")
- log = File.read(response["test.stderr"])
- log.should.be.empty?
- end
-end
-rescue LoadError
- $stderr.puts "Skipping rackup --server tests (mongrel is required). `gem install thin` and try again."
-end
\ No newline at end of file
diff --git a/vendor/gems/ruby-openid-2.1.2/.specification b/vendor/gems/ruby-openid-2.1.2/.specification
deleted file mode 100644
index 6a1a03db..00000000
--- a/vendor/gems/ruby-openid-2.1.2/.specification
+++ /dev/null
@@ -1,290 +0,0 @@
---- !ruby/object:Gem::Specification
-name: ruby-openid
-version: !ruby/object:Gem::Version
- version: 2.1.2
-platform: ruby
-authors:
-- JanRain, Inc
-autorequire: openid
-bindir: bin
-cert_chain:
-date: 2008-06-27 05:00:00 +01:00
-default_executable:
-dependencies: []
-
-description:
-email: openid@janrain.com
-executables: []
-
-extensions: []
-
-extra_rdoc_files:
-- README
-- INSTALL
-- LICENSE
-- UPGRADE
-files:
-- examples/README
-- examples/active_record_openid_store
-- examples/rails_openid
-- examples/discover
-- examples/active_record_openid_store/lib
-- examples/active_record_openid_store/test
-- examples/active_record_openid_store/init.rb
-- examples/active_record_openid_store/README
-- examples/active_record_openid_store/XXX_add_open_id_store_to_db.rb
-- examples/active_record_openid_store/XXX_upgrade_open_id_store.rb
-- examples/active_record_openid_store/lib/association.rb
-- examples/active_record_openid_store/lib/nonce.rb
-- examples/active_record_openid_store/lib/open_id_setting.rb
-- examples/active_record_openid_store/lib/openid_ar_store.rb
-- examples/active_record_openid_store/test/store_test.rb
-- examples/rails_openid/app
-- examples/rails_openid/components
-- examples/rails_openid/config
-- examples/rails_openid/db
-- examples/rails_openid/doc
-- examples/rails_openid/lib
-- examples/rails_openid/log
-- examples/rails_openid/public
-- examples/rails_openid/script
-- examples/rails_openid/test
-- examples/rails_openid/vendor
-- examples/rails_openid/Rakefile
-- examples/rails_openid/README
-- examples/rails_openid/app/controllers
-- examples/rails_openid/app/helpers
-- examples/rails_openid/app/models
-- examples/rails_openid/app/views
-- examples/rails_openid/app/controllers/application.rb
-- examples/rails_openid/app/controllers/login_controller.rb
-- examples/rails_openid/app/controllers/server_controller.rb
-- examples/rails_openid/app/controllers/consumer_controller.rb
-- examples/rails_openid/app/helpers/application_helper.rb
-- examples/rails_openid/app/helpers/login_helper.rb
-- examples/rails_openid/app/helpers/server_helper.rb
-- examples/rails_openid/app/views/layouts
-- examples/rails_openid/app/views/login
-- examples/rails_openid/app/views/server
-- examples/rails_openid/app/views/consumer
-- examples/rails_openid/app/views/layouts/server.rhtml
-- examples/rails_openid/app/views/login/index.rhtml
-- examples/rails_openid/app/views/server/decide.rhtml
-- examples/rails_openid/app/views/consumer/index.rhtml
-- examples/rails_openid/config/environments
-- examples/rails_openid/config/database.yml
-- examples/rails_openid/config/boot.rb
-- examples/rails_openid/config/environment.rb
-- examples/rails_openid/config/routes.rb
-- examples/rails_openid/config/environments/development.rb
-- examples/rails_openid/config/environments/production.rb
-- examples/rails_openid/config/environments/test.rb
-- examples/rails_openid/doc/README_FOR_APP
-- examples/rails_openid/lib/tasks
-- examples/rails_openid/public/images
-- examples/rails_openid/public/javascripts
-- examples/rails_openid/public/stylesheets
-- examples/rails_openid/public/dispatch.cgi
-- examples/rails_openid/public/404.html
-- examples/rails_openid/public/500.html
-- examples/rails_openid/public/dispatch.fcgi
-- examples/rails_openid/public/dispatch.rb
-- examples/rails_openid/public/favicon.ico
-- examples/rails_openid/public/robots.txt
-- examples/rails_openid/public/images/openid_login_bg.gif
-- examples/rails_openid/public/javascripts/controls.js
-- examples/rails_openid/public/javascripts/dragdrop.js
-- examples/rails_openid/public/javascripts/effects.js
-- examples/rails_openid/public/javascripts/prototype.js
-- examples/rails_openid/script/performance
-- examples/rails_openid/script/process
-- examples/rails_openid/script/console
-- examples/rails_openid/script/about
-- examples/rails_openid/script/breakpointer
-- examples/rails_openid/script/destroy
-- examples/rails_openid/script/generate
-- examples/rails_openid/script/plugin
-- examples/rails_openid/script/runner
-- examples/rails_openid/script/server
-- examples/rails_openid/script/performance/benchmarker
-- examples/rails_openid/script/performance/profiler
-- examples/rails_openid/script/process/spawner
-- examples/rails_openid/script/process/reaper
-- examples/rails_openid/script/process/spinner
-- examples/rails_openid/test/fixtures
-- examples/rails_openid/test/functional
-- examples/rails_openid/test/mocks
-- examples/rails_openid/test/unit
-- examples/rails_openid/test/test_helper.rb
-- examples/rails_openid/test/functional/login_controller_test.rb
-- examples/rails_openid/test/functional/server_controller_test.rb
-- examples/rails_openid/test/mocks/development
-- examples/rails_openid/test/mocks/test
-- lib/openid
-- lib/hmac
-- lib/openid.rb
-- lib/openid/cryptutil.rb
-- lib/openid/extras.rb
-- lib/openid/urinorm.rb
-- lib/openid/util.rb
-- lib/openid/trustroot.rb
-- lib/openid/message.rb
-- lib/openid/yadis
-- lib/openid/consumer
-- lib/openid/fetchers.rb
-- lib/openid/dh.rb
-- lib/openid/kvform.rb
-- lib/openid/association.rb
-- lib/openid/store
-- lib/openid/kvpost.rb
-- lib/openid/extensions
-- lib/openid/protocolerror.rb
-- lib/openid/server.rb
-- lib/openid/extension.rb
-- lib/openid/consumer.rb
-- lib/openid/yadis/htmltokenizer.rb
-- lib/openid/yadis/parsehtml.rb
-- lib/openid/yadis/filters.rb
-- lib/openid/yadis/xrds.rb
-- lib/openid/yadis/accept.rb
-- lib/openid/yadis/constants.rb
-- lib/openid/yadis/discovery.rb
-- lib/openid/yadis/xri.rb
-- lib/openid/yadis/xrires.rb
-- lib/openid/yadis/services.rb
-- lib/openid/consumer/html_parse.rb
-- lib/openid/consumer/idres.rb
-- lib/openid/consumer/associationmanager.rb
-- lib/openid/consumer/discovery.rb
-- lib/openid/consumer/discovery_manager.rb
-- lib/openid/consumer/checkid_request.rb
-- lib/openid/consumer/responses.rb
-- lib/openid/store/filesystem.rb
-- lib/openid/store/interface.rb
-- lib/openid/store/nonce.rb
-- lib/openid/store/memory.rb
-- lib/openid/extensions/sreg.rb
-- lib/openid/extensions/ax.rb
-- lib/openid/extensions/pape.rb
-- lib/hmac/hmac.rb
-- lib/hmac/sha1.rb
-- lib/hmac/sha2.rb
-- test/data
-- test/test_association.rb
-- test/test_urinorm.rb
-- test/testutil.rb
-- test/test_util.rb
-- test/test_message.rb
-- test/test_cryptutil.rb
-- test/test_extras.rb
-- test/util.rb
-- test/test_trustroot.rb
-- test/test_parsehtml.rb
-- test/test_fetchers.rb
-- test/test_dh.rb
-- test/test_kvform.rb
-- test/test_openid_yadis.rb
-- test/test_linkparse.rb
-- test/test_stores.rb
-- test/test_filters.rb
-- test/test_xrds.rb
-- test/test_nonce.rb
-- test/test_accept.rb
-- test/test_kvpost.rb
-- test/test_associationmanager.rb
-- test/discoverdata.rb
-- test/test_server.rb
-- test/test_yadis_discovery.rb
-- test/test_sreg.rb
-- test/test_idres.rb
-- test/test_ax.rb
-- test/test_xri.rb
-- test/test_xrires.rb
-- test/test_discover.rb
-- test/test_consumer.rb
-- test/test_pape.rb
-- test/test_checkid_request.rb
-- test/test_discovery_manager.rb
-- test/test_responses.rb
-- test/test_extension.rb
-- test/data/test_xrds
-- test/data/urinorm.txt
-- test/data/n2b64
-- test/data/trustroot.txt
-- test/data/dh.txt
-- test/data/test1-parsehtml.txt
-- test/data/linkparse.txt
-- test/data/accept.txt
-- test/data/test_discover
-- test/data/example-xrds.xml
-- test/data/test1-discover.txt
-- test/data/test_xrds/ref.xrds
-- test/data/test_xrds/README
-- test/data/test_xrds/delegated-20060809-r1.xrds
-- test/data/test_xrds/delegated-20060809-r2.xrds
-- test/data/test_xrds/delegated-20060809.xrds
-- test/data/test_xrds/no-xrd.xml
-- test/data/test_xrds/not-xrds.xml
-- test/data/test_xrds/prefixsometimes.xrds
-- test/data/test_xrds/sometimesprefix.xrds
-- test/data/test_xrds/spoof1.xrds
-- test/data/test_xrds/spoof2.xrds
-- test/data/test_xrds/spoof3.xrds
-- test/data/test_xrds/status222.xrds
-- test/data/test_xrds/valid-populated-xrds.xml
-- test/data/test_xrds/=j3h.2007.11.14.xrds
-- test/data/test_xrds/subsegments.xrds
-- test/data/test_discover/openid2_xrds.xml
-- test/data/test_discover/openid.html
-- test/data/test_discover/openid2.html
-- test/data/test_discover/openid2_xrds_no_local_id.xml
-- test/data/test_discover/openid_1_and_2.html
-- test/data/test_discover/openid_1_and_2_xrds.xml
-- test/data/test_discover/openid_and_yadis.html
-- test/data/test_discover/openid_1_and_2_xrds_bad_delegate.xml
-- test/data/test_discover/openid_no_delegate.html
-- test/data/test_discover/yadis_0entries.xml
-- test/data/test_discover/yadis_2_bad_local_id.xml
-- test/data/test_discover/yadis_2entries_delegate.xml
-- test/data/test_discover/yadis_2entries_idp.xml
-- test/data/test_discover/yadis_another_delegate.xml
-- test/data/test_discover/yadis_idp.xml
-- test/data/test_discover/yadis_idp_delegate.xml
-- test/data/test_discover/yadis_no_delegate.xml
-- NOTICE
-- CHANGELOG
-- README
-- INSTALL
-- LICENSE
-- UPGRADE
-- admin/runtests.rb
-has_rdoc: true
-homepage: http://openidenabled.com/ruby-openid/
-post_install_message:
-rdoc_options:
-- --main
-- README
-require_paths:
-- bin
-- lib
-required_ruby_version: !ruby/object:Gem::Requirement
- requirements:
- - - ">"
- - !ruby/object:Gem::Version
- version: 0.0.0
- version:
-required_rubygems_version: !ruby/object:Gem::Requirement
- requirements:
- - - ">="
- - !ruby/object:Gem::Version
- version: "0"
- version:
-requirements: []
-
-rubyforge_project:
-rubygems_version: 1.0.1
-signing_key:
-specification_version: 1
-summary: A library for consuming and serving OpenID identities.
-test_files:
-- admin/runtests.rb
diff --git a/vendor/gems/ruby-openid-2.1.2/CHANGELOG b/vendor/gems/ruby-openid-2.1.2/CHANGELOG
deleted file mode 100644
index deece367..00000000
--- a/vendor/gems/ruby-openid-2.1.2/CHANGELOG
+++ /dev/null
@@ -1,78 +0,0 @@
-Fri Jun 27 15:39:14 PDT 2008 Kevin Turner
- tagged 2.1.2
-
-Fri Jun 27 15:38:05 PDT 2008 Kevin Turner
- * update version to 2.1.2
-
-Fri Jun 27 15:01:35 PDT 2008 Kevin Turner
- * util: remove call to srand
-
- From the Ruby FAQ:
-
- 9.2 How do random number seeds work?
-
- It depends. In Ruby versions prior to 1.5.2, the random number generator had
- (by default) a constant seed, and so would produce the same series of numbers
- each time a program was run. If you needed less deterministic behaviors, you
- called srand to set up a less predictable seed.
-
- Newer Rubys (Rubies?) have a different behavior. If rand is called without a
- prior call to srand, Ruby will generate its own random(ish) seed. Successive
- runs of a program that does not use srand will generate different sequences of
- random numbers. To get the old, predictable, behavior (perhaps for testing),
- call srand with a constant seed.
-
-Fri Jun 27 13:34:43 PDT 2008 Kevin Turner
- * LICENSE: htmltokenizer is (c) 2004 Ben Giddings
-
-Fri Jun 27 13:32:09 PDT 2008 Kevin Turner
- * Yadis.html_yadis_location: catch HTMLTokenizerError
-
-Fri Jun 27 13:24:13 PDT 2008 Kevin Turner
- * htmltokenizer: define HTMLTokenizerError to raise
-
-Fri Jun 27 13:18:38 PDT 2008 Kevin Turner
- * htmltokenizer: Don't raise OpenIDError from htmltokenizer (it's not in the OpenID module namespace) #255
-
-Wed Jun 25 17:31:26 PDT 2008 Kevin Turner
- * OpenID::Server::CheckIDRequest.answer: document return type
-
-Wed Jun 25 17:06:35 PDT 2008 Kevin Turner
- * TrustRoot.check_sanity: don't fail if the trust root is not parseable
-
-Wed Jun 25 16:31:30 PDT 2008 Kevin Turner
- * Message.from_http_response: accept 206 code
-
-Wed Jun 25 14:14:05 PDT 2008 Kevin Turner
- * move OpenID::VERSION definition in openid.rb, for #256
-
-Wed Jun 25 13:55:18 PDT 2008 Kevin Turner
- * Add admin/gettlds.py to ease updating of TLD list in trust root validation
-
-Wed Jun 25 13:50:22 PDT 2008 Kevin Turner
- * TrustRoot.TOP_LEVEL_DOMAINS: updated
-
-Fri Jun 13 14:18:04 PDT 2008 Kevin Turner
- * xrds.rb: fix stray colon
-
-Fri Jun 13 13:41:58 PDT 2008 Kevin Turner
- * Yadis::get_canonical_id: case-insensitive comparison
-
- Porting a patch from =wil:
-
- 1. There should only be a single CanonicalID in each XRD (in the latest XRI
- resolution spec), so I made it use the first CID found instead of the last.
-
- 2. Use case-insensitive comparison when comparing CanonicalIDs.
-
-Wed Jun 11 15:24:12 PDT 2008 Kevin Turner
- * Accept response code 206 from fetcher results. Fixes #260
-
-Wed Jun 11 11:27:25 PDT 2008 cygnus@janrain.com
- * admin/fixperms: Fix stale entries
-
-Wed Jun 11 11:08:11 PDT 2008 cygnus@janrain.com
- * Add test cases for trust roots with non-ASCII characters in path or hostname
-
-Fri Jun 6 15:50:12 PDT 2008 cygnus@janrain.com
- tagged 2.1.1
diff --git a/vendor/gems/ruby-openid-2.1.2/INSTALL b/vendor/gems/ruby-openid-2.1.2/INSTALL
deleted file mode 100644
index 89f1b9bd..00000000
--- a/vendor/gems/ruby-openid-2.1.2/INSTALL
+++ /dev/null
@@ -1,47 +0,0 @@
-= Ruby OpenID Library Installation
-
-== Rubygems Installation
-
-Rubygems is a tool for installing ruby libraries and their
-dependancies. If you have rubygems installed, simply:
-
- gem install ruby-openid
-
-== Manual Installation
-
-Unpack the archive and run setup.rb to install:
-
- ruby setup.rb
-
-setup.rb installs the library into your system ruby. If don't want to
-add openid to you system ruby, you may instead add the *lib* directory of
-the extracted tarball to your RUBYLIB environment variable:
-
- $ export RUBYLIB=${RUBYLIB}:/path/to/ruby-openid/lib
-
-
-== Testing the Installation
-
-Make sure everything installed ok:
- $> irb
- irb$> require "openid"
- => true
-
-Or, if you installed via rubygems:
-
- $> irb
- irb$> require "rubygems"
- => true
- irb$> require_gem "ruby-openid"
- => true
-
-== Run the test suite
-
-Go into the test directory and execute the *runtests.rb* script.
-
-== Next steps
-
-* Run consumer.rb in the examples directory.
-* Get started writing your own consumer using OpenID::Consumer
-* Write your own server with OpenID::Server
-* Use the OpenIDLoginGenerator! Read example/README for more info.
diff --git a/vendor/gems/ruby-openid-2.1.2/LICENSE b/vendor/gems/ruby-openid-2.1.2/LICENSE
deleted file mode 100644
index c1c57734..00000000
--- a/vendor/gems/ruby-openid-2.1.2/LICENSE
+++ /dev/null
@@ -1,210 +0,0 @@
-The code in lib/hmac/ is Copyright 2001 by Daiki Ueno, and distributed under
-the terms of the Ruby license. See http://www.ruby-lang.org/en/LICENSE.txt
-
-lib/openid/yadis/htmltokenizer.rb is Copyright 2004 by Ben Giddings and
-distributed under the terms of the Ruby license.
-
-The remainder of this package is Copyright 2006-2008 by JanRain, Inc. and
-distributed under the terms of license below:
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/vendor/gems/ruby-openid-2.1.2/NOTICE b/vendor/gems/ruby-openid-2.1.2/NOTICE
deleted file mode 100644
index 62df93be..00000000
--- a/vendor/gems/ruby-openid-2.1.2/NOTICE
+++ /dev/null
@@ -1,2 +0,0 @@
-This product includes software developed by JanRain,
-available from http://openidenabled.com/
diff --git a/vendor/gems/ruby-openid-2.1.2/README b/vendor/gems/ruby-openid-2.1.2/README
deleted file mode 100644
index c6e833b4..00000000
--- a/vendor/gems/ruby-openid-2.1.2/README
+++ /dev/null
@@ -1,82 +0,0 @@
-=Ruby OpenID
-
-A Ruby library for verifying and serving OpenID identities.
-
-==Features
-* Easy to use API for verifying OpenID identites - OpenID::Consumer
-* Support for serving OpenID identites - OpenID::Server
-* Does not depend on underlying web framework
-* Supports multiple storage mechanisms (Filesystem, ActiveRecord, Memory)
-* Example code to help you get started, including:
- * Ruby on Rails based consumer and server
- * OpenIDLoginGenerator for quickly getting creating a rails app that uses
- OpenID for authentication
- * ActiveRecordOpenIDStore plugin
-* Comprehensive test suite
-* Supports both OpenID 1 and OpenID 2 transparently
-
-==Installing
-Before running the examples or writing your own code you'll need to install
-the library. See the INSTALL file or use rubygems:
-
- gem install ruby-openid
-
-Check the installation:
-
- $ irb
- irb> require 'rubygems'
- irb> require_gem 'ruby-openid'
- => true
-
-The library is known to work with Ruby 1.8.4 on Unix, Max OSX and
-Win32. Examples have been tested with Rails 1.1 and 1.2, and 2.0.
-
-==Getting Started
-The best way to start is to look at the rails_openid example.
-You can run it with:
- cd examples/rails_openid
- script/server
-
-If you are writing an OpenID Relying Party, a good place to start is:
-examples/rails_openid/app/controllers/consumer_controller.rb
-
-And if you are writing an OpenID provider:
-examples/rails_openid/app/controllers/server_controller.rb
-
-The library code is quite well documented, so don't be squeamish, and
-look at the library itself if there's anything you don't understand in
-the examples.
-
-==Homepage
-http://openidenabled.com/ruby-openid/
-
-See also:
-http://openid.net/
-http://openidenabled.com/
-
-==Community
-Discussion regarding the Ruby OpenID library and other JanRain OpenID
-libraries takes place on the the OpenID mailing list on
-openidenabled.com.
-
-http://lists.openidenabled.com/mailman/listinfo/dev
-
-Please join this list to discuss, ask implementation questions, report
-bugs, etc. Also check out the openid channel on the freenode IRC
-network.
-
-If you have a bugfix or feature you'd like to contribute, don't
-hesitate to send it to us. For more detailed information on how to
-contribute, see
-
- http://openidenabled.com/contribute/
-
-==Author
-Copyright 2006-2008, JanRain, Inc.
-
-Contact openid@janrain.com or visit the OpenID channel on pibb.com:
-
-http://pibb.com/go/openid
-
-==License
-Apache Software License. For more information see the LICENSE file.
diff --git a/vendor/gems/ruby-openid-2.1.2/UPGRADE b/vendor/gems/ruby-openid-2.1.2/UPGRADE
deleted file mode 100644
index b80e8232..00000000
--- a/vendor/gems/ruby-openid-2.1.2/UPGRADE
+++ /dev/null
@@ -1,127 +0,0 @@
-= Upgrading from the OpenID 1.x series library
-
-== Consumer Upgrade
-
-The flow is largely the same, however there are a number of significant
-changes. The consumer example is helpful to look at:
-examples/rails_openid/app/controllers/consumer_controller.rb
-
-
-=== Stores
-
-You will need to require the file for the store that you are using.
-For the filesystem store, this is 'openid/stores/filesystem'
-They are also now in modules. The filesystem store is
- OpenID::Store::Filesystem
-The format has changed, and you should remove your old store directory.
-
-The ActiveRecord store ( examples/active_record_openid_store ) still needs
-to be put in a plugin directory for your rails app. There's a migration
-that needs to be run; examine the README in that directory.
-
-Also, note that the stores now can be garbage collected with the method
- store.cleanup
-
-
-=== Starting the OpenID transaction
-
-The OpenIDRequest object no longer has status codes. Instead,
-consumer.begin raises an OpenID::OpenIDError if there is a problem
-initiating the transaction, so you'll want something along the lines of:
-
- begin
- openid_request = consumer.begin(params[:openid_identifier])
- rescue OpenID::OpenIDError => e
- # display error e
- return
- end
- #success case
-
-Data regarding the OpenID server once lived in
- openid_request.service
-
-The corresponding object in the 2.0 lib can be retrieved with
- openid_request.endpoint
-
-Getting the unverified identifier: Where you once had
- openid_request.identity_url
-you will now want
- openid_request.endpoint.claimed_id
-which might be different from what you get at the end of the transaction,
-since it is now possible for users to enter their server's url directly.
-
-Arguments on the return_to URL are now verified, so if you want to add
-additional arguments to the return_to url, use
- openid_request.return_to_args['param'] = value
-
-Generating the redirect is the same as before, but add any extensions
-first.
-
-If you need to set up an SSL certificate authority list for the fetcher,
-use the 'ca_file' attr_accessor on the OpenID::StandardFetcher. This has
-changed from 'ca_path' in the 1.x.x series library. That is, set
-OpenID.fetcher.ca_file = '/path/to/ca.list'
-before calling consumer.begin.
-
-=== Requesting Simple Registration Data
-
-You'll need to require the code for the extension
- require 'openid/extensions/sreg'
-
-The new code for adding an SReg request now looks like:
-
- sreg_request = OpenID::SReg::Request.new
- sreg_request.request_fields(['email', 'dob'], true) # required
- sreg_request.request_fields(['nickname', 'fullname'], false) # optional
- sreg_request.policy_url = policy_url
- openid_request.add_extension(sreg_request)
-
-The code for adding other extensions is similar. Code for the Attribute
-Exchange (AX) and Provider Authentication Policy Extension (PAPE) are
-included with the library, and additional extensions can be implemented
-subclassing OpenID::Extension.
-
-
-=== Completing the transaction
-
-The return_to and its arguments are verified, so you need to pass in
-the base URL and the arguments. With Rails, the params method mashes
-together parameters from GET, POST, and the path, so you'll need to pull
-off the path "parameters" with something like
-
- return_to = url_for(:only_path => false,
- :controller => 'openid',
- :action => 'complete')
- parameters = params.reject{|k,v| request.path_parameters[k] }
- openid_response = consumer.complete(parameters, return_to)
-
-The response still uses the status codes, but they are now namespaced
-slightly differently, for example OpenID::Consumer::SUCCESS
-
-In the case of failure, the error message is now found in
- openid_response.message
-
-The identifier to display to the user can be found in
- openid_response.endpoint.display_identifier
-
-The Simple Registration response can be read from the OpenID response
-with
- sreg_response = OpenID::SReg::Response.from_success_response(openid_response)
- nickname = sreg_response['nickname']
- # etc.
-
-
-== Server Upgrade
-
-The server code is mostly the same as before, with the exception of
-extensions. Also, you must pass in the endpoint URL to the server
-constructor:
- @server = OpenID::Server.new(store, server_url)
-
-I recommend looking at
-examples/rails_openid/app/controllers/server_controller.rb
-for an example of the new way of doing extensions.
-
---
-Dag Arneson, JanRain Inc.
-Please direct questions to openid@janrain.com
diff --git a/vendor/gems/ruby-openid-2.1.2/admin/runtests.rb b/vendor/gems/ruby-openid-2.1.2/admin/runtests.rb
deleted file mode 100644
index 50abe044..00000000
--- a/vendor/gems/ruby-openid-2.1.2/admin/runtests.rb
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/ruby
-
-require "logger"
-require "stringio"
-require "pathname"
-
-require 'test/unit/collector/dir'
-require 'test/unit/ui/console/testrunner'
-
-def main
- old_verbose = $VERBOSE
- $VERBOSE = true
-
- tests_dir = Pathname.new(__FILE__).dirname.dirname.join('test')
-
- # Collect tests from everything named test_*.rb.
- c = Test::Unit::Collector::Dir.new
-
- if c.respond_to?(:base=)
- # In order to supress warnings from ruby 1.8.6 about accessing
- # undefined member
- c.base = tests_dir
- suite = c.collect
- else
- # Because base is not defined in ruby < 1.8.6
- suite = c.collect(tests_dir)
- end
-
-
- result = Test::Unit::UI::Console::TestRunner.run(suite)
- result.passed?
-ensure
- $VERBOSE = old_verbose
-end
-
-exit(main)
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/README b/vendor/gems/ruby-openid-2.1.2/examples/README
deleted file mode 100644
index 71aa30d7..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/README
+++ /dev/null
@@ -1,32 +0,0 @@
-This directory contains several examples that demonstrate use of the
-OpenID library. Make sure you have properly installed the library
-before running the examples. These examples are a great place to
-start in integrating OpenID into your application.
-
-==Rails example
-
-The rails_openid contains a fully functional OpenID server and relying
-party, and acts as a starting point for implementing your own
-production rails server. You'll need the latest version of Ruby on
-Rails installed, and then:
-
- cd rails_openid
- ./script/server
-
-Open a web browser to http://localhost:3000/ and follow the instructions.
-
-The relevant code to work from when writing your Rails OpenID Relying
-Party is:
- rails_openid/app/controllers/consumer_controller.rb
-If you are working on an OpenID provider, check out
- rails_openid/app/controllers/server_controller.rb
-
-Since the library and examples are Apache-licensed, don't be shy about
-copy-and-paste.
-
-==Rails ActiveRecord OpenIDStore plugin
-
-For various reasons you may want or need to deploy your ruby openid
-consumer/server using an SQL based store. The active_record_openid_store
-is a plugin that makes using an SQL based store simple. Follow the
-README inside the plugin's dir for usage.
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/active_record_openid_store/README b/vendor/gems/ruby-openid-2.1.2/examples/active_record_openid_store/README
deleted file mode 100644
index 11787298..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/active_record_openid_store/README
+++ /dev/null
@@ -1,58 +0,0 @@
-=Active Record OpenID Store Plugin
-
-A store is required by an OpenID server and optionally by the consumer
-to store associations, nonces, and auth key information across
-requests and processes. If rails is distributed across several
-machines, they must must all have access to the same OpenID store
-data, so the FilesystemStore won't do.
-
-This directory contains a plugin for connecting your
-OpenID enabled rails app to an ActiveRecord based OpenID store.
-
-==Install
-
-1) Copy this directory and all it's contents into your
-RAILS_ROOT/vendor/plugins directory. You structure should look like
-this:
-
- RAILS_ROOT/vendor/plugins/active_record_openid_store/
-
-2) Copy the migration, XXX_add_open_id_store_to_db.rb to your
- RAILS_ROOT/db/migrate directory. Rename the XXX portion of the
- file to next sequential migration number.
-
-3) Run the migration:
-
- rake migrate
-
-4) Change your app to use the ActiveRecordOpenIDStore:
-
- store = ActiveRecordOpenIDStore.new
- consumer = OpenID::Consumer.new(session, store)
-
-5) That's it! All your OpenID state will now be stored in the database.
-
-==Upgrade
-
-If you are upgrading from the 1.x ActiveRecord store, replace your old
-RAILS_ROOT/vendor/plugins/active_record_openid_store/ directory with
-the new one and run the migration XXX_upgrade_open_id_store.rb.
-
-==What about garbage collection?
-
-You may garbage collect unused nonces and expired associations using
-the gc instance method of ActiveRecordOpenIDStore. Hook it up to a
-task in your app's Rakefile like so:
-
- desc 'GC OpenID store'
- task :gc_openid_store => :environment do
- ActiveRecordOpenIDStore.new.cleanup
- end
-
-Run it by typing:
-
- rake gc_openid_store
-
-
-==Questions?
-Contact Dag Arneson: dag at janrain dot com
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/active_record_openid_store/XXX_add_open_id_store_to_db.rb b/vendor/gems/ruby-openid-2.1.2/examples/active_record_openid_store/XXX_add_open_id_store_to_db.rb
deleted file mode 100644
index 99625453..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/active_record_openid_store/XXX_add_open_id_store_to_db.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-# Use this migration to create the tables for the ActiveRecord store
-class AddOpenIdStoreToDb < ActiveRecord::Migration
- def self.up
- create_table "open_id_associations", :force => true do |t|
- t.column "server_url", :binary, :null => false
- t.column "handle", :string, :null => false
- t.column "secret", :binary, :null => false
- t.column "issued", :integer, :null => false
- t.column "lifetime", :integer, :null => false
- t.column "assoc_type", :string, :null => false
- end
-
- create_table "open_id_nonces", :force => true do |t|
- t.column :server_url, :string, :null => false
- t.column :timestamp, :integer, :null => false
- t.column :salt, :string, :null => false
- end
- end
-
- def self.down
- drop_table "open_id_associations"
- drop_table "open_id_nonces"
- end
-end
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/active_record_openid_store/XXX_upgrade_open_id_store.rb b/vendor/gems/ruby-openid-2.1.2/examples/active_record_openid_store/XXX_upgrade_open_id_store.rb
deleted file mode 100644
index 273d285b..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/active_record_openid_store/XXX_upgrade_open_id_store.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-# Use this migration to upgrade the old 1.1 ActiveRecord store schema
-# to the new 2.0 schema.
-class UpgradeOpenIdStore < ActiveRecord::Migration
- def self.up
- drop_table "open_id_settings"
- drop_table "open_id_nonces"
- create_table "open_id_nonces", :force => true do |t|
- t.column :server_url, :string, :null => false
- t.column :timestamp, :integer, :null => false
- t.column :salt, :string, :null => false
- end
- end
-
- def self.down
- drop_table "open_id_nonces"
- create_table "open_id_nonces", :force => true do |t|
- t.column "nonce", :string
- t.column "created", :integer
- end
-
- create_table "open_id_settings", :force => true do |t|
- t.column "setting", :string
- t.column "value", :binary
- end
- end
-end
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/active_record_openid_store/init.rb b/vendor/gems/ruby-openid-2.1.2/examples/active_record_openid_store/init.rb
deleted file mode 100644
index b625179e..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/active_record_openid_store/init.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-# might using the ruby-openid gem
-begin
- require 'rubygems'
-rescue LoadError
- nil
-end
-require 'openid'
-require 'openid_ar_store'
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/active_record_openid_store/lib/association.rb b/vendor/gems/ruby-openid-2.1.2/examples/active_record_openid_store/lib/association.rb
deleted file mode 100644
index 09eda8b5..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/active_record_openid_store/lib/association.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-require 'openid/association'
-require 'time'
-
-class Association < ActiveRecord::Base
- set_table_name 'open_id_associations'
- def from_record
- OpenID::Association.new(handle, secret, Time.at(issued), lifetime, assoc_type)
- end
-end
-
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/active_record_openid_store/lib/nonce.rb b/vendor/gems/ruby-openid-2.1.2/examples/active_record_openid_store/lib/nonce.rb
deleted file mode 100644
index fcf51530..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/active_record_openid_store/lib/nonce.rb
+++ /dev/null
@@ -1,3 +0,0 @@
-class Nonce < ActiveRecord::Base
- set_table_name 'open_id_nonces'
-end
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/active_record_openid_store/lib/open_id_setting.rb b/vendor/gems/ruby-openid-2.1.2/examples/active_record_openid_store/lib/open_id_setting.rb
deleted file mode 100644
index 030e4c25..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/active_record_openid_store/lib/open_id_setting.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-class OpenIdSetting < ActiveRecord::Base
-
- validates_uniqueness_of :setting
-end
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/active_record_openid_store/lib/openid_ar_store.rb b/vendor/gems/ruby-openid-2.1.2/examples/active_record_openid_store/lib/openid_ar_store.rb
deleted file mode 100644
index 276569c5..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/active_record_openid_store/lib/openid_ar_store.rb
+++ /dev/null
@@ -1,57 +0,0 @@
-require 'association'
-require 'nonce'
-require 'openid/store/interface'
-
-# not in OpenID module to avoid namespace conflict
-class ActiveRecordStore < OpenID::Store::Interface
- def store_association(server_url, assoc)
- remove_association(server_url, assoc.handle)
- Association.create!(:server_url => server_url,
- :handle => assoc.handle,
- :secret => assoc.secret,
- :issued => assoc.issued.to_i,
- :lifetime => assoc.lifetime,
- :assoc_type => assoc.assoc_type)
- end
-
- def get_association(server_url, handle=nil)
- assocs = if handle.blank?
- Association.find_all_by_server_url(server_url)
- else
- Association.find_all_by_server_url_and_handle(server_url, handle)
- end
-
- assocs.reverse.each do |assoc|
- a = assoc.from_record
- if a.expires_in == 0
- assoc.destroy
- else
- return a
- end
- end if assocs.any?
-
- return nil
- end
-
- def remove_association(server_url, handle)
- Association.delete_all(['server_url = ? AND handle = ?', server_url, handle]) > 0
- end
-
- def use_nonce(server_url, timestamp, salt)
- return false if Nonce.find_by_server_url_and_timestamp_and_salt(server_url, timestamp, salt)
- return false if (timestamp - Time.now.to_i).abs > OpenID::Nonce.skew
- Nonce.create!(:server_url => server_url, :timestamp => timestamp, :salt => salt)
- return true
- end
-
- def cleanup_nonces
- now = Time.now.to_i
- Nonce.delete_all(["timestamp > ? OR timestamp < ?", now + OpenID::Nonce.skew, now - OpenID::Nonce.skew])
- end
-
- def cleanup_associations
- now = Time.now.to_i
- Association.delete_all(['issued + lifetime > ?',now])
- end
-
-end
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/active_record_openid_store/test/store_test.rb b/vendor/gems/ruby-openid-2.1.2/examples/active_record_openid_store/test/store_test.rb
deleted file mode 100644
index 8e1986c6..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/active_record_openid_store/test/store_test.rb
+++ /dev/null
@@ -1,212 +0,0 @@
-$:.unshift(File.dirname(__FILE__) + '/../lib')
-require 'test/unit'
-RAILS_ENV = "test"
-require File.expand_path(File.join(File.dirname(__FILE__), '../../../../config/environment.rb'))
-
-module StoreTestCase
- @@allowed_handle = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~'
- @@allowed_nonce = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
-
- def _gen_nonce
- OpenID::CryptUtil.random_string(8, @@allowed_nonce)
- end
-
- def _gen_handle(n)
- OpenID::CryptUtil.random_string(n, @@allowed_handle)
- end
-
- def _gen_secret(n, chars=nil)
- OpenID::CryptUtil.random_string(n, chars)
- end
-
- def _gen_assoc(issued, lifetime=600)
- secret = _gen_secret(20)
- handle = _gen_handle(128)
- OpenID::Association.new(handle, secret, Time.now + issued, lifetime,
- 'HMAC-SHA1')
- end
-
- def _check_retrieve(url, handle=nil, expected=nil)
- ret_assoc = @store.get_association(url, handle)
-
- if expected.nil?
- assert_nil(ret_assoc)
- else
- assert_equal(expected, ret_assoc)
- assert_equal(expected.handle, ret_assoc.handle)
- assert_equal(expected.secret, ret_assoc.secret)
- end
- end
-
- def _check_remove(url, handle, expected)
- present = @store.remove_association(url, handle)
- assert_equal(expected, present)
- end
-
- def test_store
- server_url = "http://www.myopenid.com/openid"
- assoc = _gen_assoc(issued=0)
-
- # Make sure that a missing association returns no result
- _check_retrieve(server_url)
-
- # Check that after storage, getting returns the same result
- @store.store_association(server_url, assoc)
- _check_retrieve(server_url, nil, assoc)
-
- # more than once
- _check_retrieve(server_url, nil, assoc)
-
- # Storing more than once has no ill effect
- @store.store_association(server_url, assoc)
- _check_retrieve(server_url, nil, assoc)
-
- # Removing an association that does not exist returns not present
- _check_remove(server_url, assoc.handle + 'x', false)
-
- # Removing an association that does not exist returns not present
- _check_remove(server_url + 'x', assoc.handle, false)
-
- # Removing an association that is present returns present
- _check_remove(server_url, assoc.handle, true)
-
- # but not present on subsequent calls
- _check_remove(server_url, assoc.handle, false)
-
- # Put assoc back in the store
- @store.store_association(server_url, assoc)
-
- # More recent and expires after assoc
- assoc2 = _gen_assoc(issued=1)
- @store.store_association(server_url, assoc2)
-
- # After storing an association with a different handle, but the
- # same server_url, the handle with the later expiration is returned.
- _check_retrieve(server_url, nil, assoc2)
-
- # We can still retrieve the older association
- _check_retrieve(server_url, assoc.handle, assoc)
-
- # Plus we can retrieve the association with the later expiration
- # explicitly
- _check_retrieve(server_url, assoc2.handle, assoc2)
-
- # More recent, and expires earlier than assoc2 or assoc. Make sure
- # that we're picking the one with the latest issued date and not
- # taking into account the expiration.
- assoc3 = _gen_assoc(issued=2, lifetime=100)
- @store.store_association(server_url, assoc3)
-
- _check_retrieve(server_url, nil, assoc3)
- _check_retrieve(server_url, assoc.handle, assoc)
- _check_retrieve(server_url, assoc2.handle, assoc2)
- _check_retrieve(server_url, assoc3.handle, assoc3)
-
- _check_remove(server_url, assoc2.handle, true)
-
- _check_retrieve(server_url, nil, assoc3)
- _check_retrieve(server_url, assoc.handle, assoc)
- _check_retrieve(server_url, assoc2.handle, nil)
- _check_retrieve(server_url, assoc3.handle, assoc3)
-
- _check_remove(server_url, assoc2.handle, false)
- _check_remove(server_url, assoc3.handle, true)
-
- _check_retrieve(server_url, nil, assoc)
- _check_retrieve(server_url, assoc.handle, assoc)
- _check_retrieve(server_url, assoc2.handle, nil)
- _check_retrieve(server_url, assoc3.handle, nil)
-
- _check_remove(server_url, assoc2.handle, false)
- _check_remove(server_url, assoc.handle, true)
- _check_remove(server_url, assoc3.handle, false)
-
- _check_retrieve(server_url, nil, nil)
- _check_retrieve(server_url, assoc.handle, nil)
- _check_retrieve(server_url, assoc2.handle, nil)
- _check_retrieve(server_url, assoc3.handle, nil)
-
- _check_remove(server_url, assoc2.handle, false)
- _check_remove(server_url, assoc.handle, false)
- _check_remove(server_url, assoc3.handle, false)
-
- assocValid1 = _gen_assoc(-3600, 7200)
- assocValid2 = _gen_assoc(-5)
- assocExpired1 = _gen_assoc(-7200, 3600)
- assocExpired2 = _gen_assoc(-7200, 3600)
-
- @store.cleanup_associations
- @store.store_association(server_url + '1', assocValid1)
- @store.store_association(server_url + '1', assocExpired1)
- @store.store_association(server_url + '2', assocExpired2)
- @store.store_association(server_url + '3', assocValid2)
-
- cleaned = @store.cleanup_associations()
- assert_equal(2, cleaned, "cleaned up associations")
- end
-
- def _check_use_nonce(nonce, expected, server_url, msg='')
- stamp, salt = OpenID::Nonce::split_nonce(nonce)
- actual = @store.use_nonce(server_url, stamp, salt)
- assert_equal(expected, actual, msg)
- end
-
- def test_nonce
- server_url = "http://www.myopenid.com/openid"
- [server_url, ''].each{|url|
- nonce1 = OpenID::Nonce::mk_nonce
-
- _check_use_nonce(nonce1, true, url, "#{url}: nonce allowed by default")
- _check_use_nonce(nonce1, false, url, "#{url}: nonce not allowed twice")
- _check_use_nonce(nonce1, false, url, "#{url}: nonce not allowed third time")
-
- # old nonces shouldn't pass
- old_nonce = OpenID::Nonce::mk_nonce(3600)
- _check_use_nonce(old_nonce, false, url, "Old nonce #{old_nonce.inspect} passed")
-
- }
-
- now = Time.now.to_i
- old_nonce1 = OpenID::Nonce::mk_nonce(now - 20000)
- old_nonce2 = OpenID::Nonce::mk_nonce(now - 10000)
- recent_nonce = OpenID::Nonce::mk_nonce(now - 600)
-
- orig_skew = OpenID::Nonce.skew
- OpenID::Nonce.skew = 0
- count = @store.cleanup_nonces
- OpenID::Nonce.skew = 1000000
- ts, salt = OpenID::Nonce::split_nonce(old_nonce1)
- assert(@store.use_nonce(server_url, ts, salt), "oldnonce1")
- ts, salt = OpenID::Nonce::split_nonce(old_nonce2)
- assert(@store.use_nonce(server_url, ts, salt), "oldnonce2")
- ts, salt = OpenID::Nonce::split_nonce(recent_nonce)
- assert(@store.use_nonce(server_url, ts, salt), "recent_nonce")
-
-
- OpenID::Nonce.skew = 1000
- cleaned = @store.cleanup_nonces
- assert_equal(2, cleaned, "Cleaned #{cleaned} nonces")
-
- OpenID::Nonce.skew = 100000
- ts, salt = OpenID::Nonce::split_nonce(old_nonce1)
- assert(@store.use_nonce(server_url, ts, salt), "oldnonce1 after cleanup")
- ts, salt = OpenID::Nonce::split_nonce(old_nonce2)
- assert(@store.use_nonce(server_url, ts, salt), "oldnonce2 after cleanup")
- ts, salt = OpenID::Nonce::split_nonce(recent_nonce)
- assert(!@store.use_nonce(server_url, ts, salt), "recent_nonce after cleanup")
-
- OpenID::Nonce.skew = orig_skew
-
- end
-end
-
-
-class TestARStore < Test::Unit::TestCase
- include StoreTestCase
-
- def setup
- @store = ActiveRecordStore.new
- end
-
-end
-
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/discover b/vendor/gems/ruby-openid-2.1.2/examples/discover
deleted file mode 100644
index ab985a49..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/discover
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/usr/bin/env ruby
-require "openid/consumer/discovery"
-require 'openid/fetchers'
-
-OpenID::fetcher_use_env_http_proxy
-
-$names = [[:server_url, "Server URL "],
- [:local_id, "Local ID "],
- [:canonical_id, "Canonical ID"],
- ]
-
-def show_services(user_input, normalized, services)
- puts " Claimed identifier: #{normalized}"
- if services.empty?
- puts " No OpenID services found"
- puts
- else
- puts " Discovered services:"
- n = 0
- services.each do |service|
- n += 1
- puts " #{n}."
- $names.each do |meth, name|
- val = service.send(meth)
- if val
- printf(" %s: %s\n", name, val)
- end
- end
- puts " Type URIs:"
- for type_uri in service.type_uris
- puts " * #{type_uri}"
- end
- puts
- end
- end
-end
-
-ARGV.each do |openid_identifier|
- puts "=" * 50
- puts "Running discovery on #{openid_identifier}"
- begin
- normalized_identifier, services = OpenID.discover(openid_identifier)
- rescue OpenID::DiscoveryFailure => why
- puts "Discovery failed: #{why.message}"
- puts
- else
- show_services(openid_identifier, normalized_identifier, services)
- end
-end
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/README b/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/README
deleted file mode 100644
index cd9d0ffe..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/README
+++ /dev/null
@@ -1,153 +0,0 @@
-== Welcome to Rails
-
-Rails is a web-application and persistence framework that includes everything
-needed to create database-backed web-applications according to the
-Model-View-Control pattern of separation. This pattern splits the view (also
-called the presentation) into "dumb" templates that are primarily responsible
-for inserting pre-built data in between HTML tags. The model contains the
-"smart" domain objects (such as Account, Product, Person, Post) that holds all
-the business logic and knows how to persist themselves to a database. The
-controller handles the incoming requests (such as Save New Account, Update
-Product, Show Post) by manipulating the model and directing data to the view.
-
-In Rails, the model is handled by what's called an object-relational mapping
-layer entitled Active Record. This layer allows you to present the data from
-database rows as objects and embellish these data objects with business logic
-methods. You can read more about Active Record in
-link:files/vendor/rails/activerecord/README.html.
-
-The controller and view are handled by the Action Pack, which handles both
-layers by its two parts: Action View and Action Controller. These two layers
-are bundled in a single package due to their heavy interdependence. This is
-unlike the relationship between the Active Record and Action Pack that is much
-more separate. Each of these packages can be used independently outside of
-Rails. You can read more about Action Pack in
-link:files/vendor/rails/actionpack/README.html.
-
-
-== Getting started
-
-1. Run the WEBrick servlet: ruby script/server (run with --help for options)
- ...or if you have lighttpd installed: ruby script/lighttpd (it's faster)
-2. Go to http://localhost:3000/ and get "Congratulations, you've put Ruby on Rails!"
-3. Follow the guidelines on the "Congratulations, you've put Ruby on Rails!" screen
-
-
-== Example for Apache conf
-
-
- ServerName rails
- DocumentRoot /path/application/public/
- ErrorLog /path/application/log/server.log
-
-
- Options ExecCGI FollowSymLinks
- AllowOverride all
- Allow from all
- Order allow,deny
-
-
-
-NOTE: Be sure that CGIs can be executed in that directory as well. So ExecCGI
-should be on and ".cgi" should respond. All requests from 127.0.0.1 go
-through CGI, so no Apache restart is necessary for changes. All other requests
-go through FCGI (or mod_ruby), which requires a restart to show changes.
-
-
-== Debugging Rails
-
-Have "tail -f" commands running on both the server.log, production.log, and
-test.log files. Rails will automatically display debugging and runtime
-information to these files. Debugging info will also be shown in the browser
-on requests from 127.0.0.1.
-
-
-== Breakpoints
-
-Breakpoint support is available through the script/breakpointer client. This
-means that you can break out of execution at any point in the code, investigate
-and change the model, AND then resume execution! Example:
-
- class WeblogController < ActionController::Base
- def index
- @posts = Post.find_all
- breakpoint "Breaking out from the list"
- end
- end
-
-So the controller will accept the action, run the first line, then present you
-with a IRB prompt in the breakpointer window. Here you can do things like:
-
-Executing breakpoint "Breaking out from the list" at .../webrick_server.rb:16 in 'breakpoint'
-
- >> @posts.inspect
- => "[#nil, \"body\"=>nil, \"id\"=>\"1\"}>,
- #\"Rails you know!\", \"body\"=>\"Only ten..\", \"id\"=>\"2\"}>]"
- >> @posts.first.title = "hello from a breakpoint"
- => "hello from a breakpoint"
-
-...and even better is that you can examine how your runtime objects actually work:
-
- >> f = @posts.first
- => #nil, "body"=>nil, "id"=>"1"}>
- >> f.
- Display all 152 possibilities? (y or n)
-
-Finally, when you're ready to resume execution, you press CTRL-D
-
-
-== Console
-
-You can interact with the domain model by starting the console through script/console.
-Here you'll have all parts of the application configured, just like it is when the
-application is running. You can inspect domain models, change values, and save to the
-database. Starting the script without arguments will launch it in the development environment.
-Passing an argument will specify a different environment, like console production.
-
-
-== Description of contents
-
-app
- Holds all the code that's specific to this particular application.
-
-app/controllers
- Holds controllers that should be named like weblog_controller.rb for
- automated URL mapping. All controllers should descend from
- ActionController::Base.
-
-app/models
- Holds models that should be named like post.rb.
- Most models will descend from ActiveRecord::Base.
-
-app/views
- Holds the template files for the view that should be named like
- weblog/index.rhtml for the WeblogController#index action. All views use eRuby
- syntax. This directory can also be used to keep stylesheets, images, and so on
- that can be symlinked to public.
-
-app/helpers
- Holds view helpers that should be named like weblog_helper.rb.
-
-config
- Configuration files for the Rails environment, the routing map, the database, and other dependencies.
-
-components
- Self-contained mini-applications that can bundle together controllers, models, and views.
-
-lib
- Application specific libraries. Basically, any kind of custom code that doesn't
- belong under controllers, models, or helpers. This directory is in the load path.
-
-public
- The directory available for the web server. Contains subdirectories for images, stylesheets,
- and javascripts. Also contains the dispatchers and the default HTML files.
-
-script
- Helper scripts for automation and generation.
-
-test
- Unit and functional tests along with fixtures.
-
-vendor
- External libraries that the application depends on. Also includes the plugins subdirectory.
- This directory is in the load path.
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/Rakefile b/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/Rakefile
deleted file mode 100644
index cffd19f0..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/Rakefile
+++ /dev/null
@@ -1,10 +0,0 @@
-# Add your own tasks in files placed in lib/tasks ending in .rake,
-# for example lib/tasks/switchtower.rake, and they will automatically be available to Rake.
-
-require(File.join(File.dirname(__FILE__), 'config', 'boot'))
-
-require 'rake'
-require 'rake/testtask'
-require 'rake/rdoctask'
-
-require 'tasks/rails'
\ No newline at end of file
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/app/controllers/application.rb b/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/app/controllers/application.rb
deleted file mode 100644
index 537de40d..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/app/controllers/application.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-# Filters added to this controller will be run for all controllers in the application.
-# Likewise, all the methods added will be available for all controllers.
-class ApplicationController < ActionController::Base
-end
\ No newline at end of file
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/app/controllers/consumer_controller.rb b/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/app/controllers/consumer_controller.rb
deleted file mode 100644
index 37dd3bbd..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/app/controllers/consumer_controller.rb
+++ /dev/null
@@ -1,122 +0,0 @@
-require 'pathname'
-
-require "openid"
-require 'openid/extensions/sreg'
-require 'openid/extensions/pape'
-require 'openid/store/filesystem'
-
-class ConsumerController < ApplicationController
- layout nil
-
- def index
- # render an openid form
- end
-
- def start
- begin
- identifier = params[:openid_identifier]
- if identifier.nil?
- flash[:error] = "Enter an OpenID identifier"
- redirect_to :action => 'index'
- return
- end
- oidreq = consumer.begin(identifier)
- rescue OpenID::OpenIDError => e
- flash[:error] = "Discovery failed for #{identifier}: #{e}"
- redirect_to :action => 'index'
- return
- end
- if params[:use_sreg]
- sregreq = OpenID::SReg::Request.new
- # required fields
- sregreq.request_fields(['email','nickname'], true)
- # optional fields
- sregreq.request_fields(['dob', 'fullname'], false)
- oidreq.add_extension(sregreq)
- oidreq.return_to_args['did_sreg'] = 'y'
- end
- if params[:use_pape]
- papereq = OpenID::PAPE::Request.new
- papereq.add_policy_uri(OpenID::PAPE::AUTH_PHISHING_RESISTANT)
- papereq.max_auth_age = 2*60*60
- oidreq.add_extension(papereq)
- oidreq.return_to_args['did_pape'] = 'y'
- end
- if params[:force_post]
- oidreq.return_to_args['force_post']='x'*2048
- end
- return_to = url_for :action => 'complete', :only_path => false
- realm = url_for :action => 'index', :only_path => false
-
- if oidreq.send_redirect?(realm, return_to, params[:immediate])
- redirect_to oidreq.redirect_url(realm, return_to, params[:immediate])
- else
- render :text => oidreq.html_markup(realm, return_to, params[:immediate], {'id' => 'openid_form'})
- end
- end
-
- def complete
- # FIXME - url_for some action is not necessarily the current URL.
- current_url = url_for(:action => 'complete', :only_path => false)
- parameters = params.reject{|k,v|request.path_parameters[k]}
- oidresp = consumer.complete(parameters, current_url)
- case oidresp.status
- when OpenID::Consumer::FAILURE
- if oidresp.display_identifier
- flash[:error] = ("Verification of #{oidresp.display_identifier}"\
- " failed: #{oidresp.message}")
- else
- flash[:error] = "Verification failed: #{oidresp.message}"
- end
- when OpenID::Consumer::SUCCESS
- flash[:success] = ("Verification of #{oidresp.display_identifier}"\
- " succeeded.")
- if params[:did_sreg]
- sreg_resp = OpenID::SReg::Response.from_success_response(oidresp)
- sreg_message = "Simple Registration data was requested"
- if sreg_resp.empty?
- sreg_message << ", but none was returned."
- else
- sreg_message << ". The following data were sent:"
- sreg_resp.data.each {|k,v|
- sreg_message << "
#{k}: #{v}"
- }
- end
- flash[:sreg_results] = sreg_message
- end
- if params[:did_pape]
- pape_resp = OpenID::PAPE::Response.from_success_response(oidresp)
- pape_message = "A phishing resistant authentication method was requested"
- if pape_resp.auth_policies.member? OpenID::PAPE::AUTH_PHISHING_RESISTANT
- pape_message << ", and the server reported one."
- else
- pape_message << ", but the server did not report one."
- end
- if pape_resp.auth_time
- pape_message << "
Authentication time: #{pape_resp.auth_time} seconds"
- end
- if pape_resp.nist_auth_level
- pape_message << "
NIST Auth Level: #{pape_resp.nist_auth_level}"
- end
- flash[:pape_results] = pape_message
- end
- when OpenID::Consumer::SETUP_NEEDED
- flash[:alert] = "Immediate request failed - Setup Needed"
- when OpenID::Consumer::CANCEL
- flash[:alert] = "OpenID transaction cancelled."
- else
- end
- redirect_to :action => 'index'
- end
-
- private
-
- def consumer
- if @consumer.nil?
- dir = Pathname.new(RAILS_ROOT).join('db').join('cstore')
- store = OpenID::Store::Filesystem.new(dir)
- @consumer = OpenID::Consumer.new(session, store)
- end
- return @consumer
- end
-end
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/app/controllers/login_controller.rb b/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/app/controllers/login_controller.rb
deleted file mode 100644
index ff7c257b..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/app/controllers/login_controller.rb
+++ /dev/null
@@ -1,45 +0,0 @@
-# Controller for handling the login, logout process for "users" of our
-# little server. Users have no password. This is just an example.
-
-require 'openid'
-
-class LoginController < ApplicationController
-
- layout 'server'
-
- def base_url
- url_for(:controller => 'login', :action => nil, :only_path => false)
- end
-
- def index
- response.headers['X-XRDS-Location'] = url_for(:controller => "server",
- :action => "idp_xrds",
- :only_path => false)
- @base_url = base_url
- # just show the login page
- end
-
- def submit
- user = params[:username]
-
- # if we get a user, log them in by putting their username in
- # the session hash.
- unless user.nil?
- session[:username] = user unless user.nil?
- session[:approvals] = []
- flash[:notice] = "Your OpenID URL is #{base_url}user/#{user}
Proceed to step 2 below."
- else
- flash[:error] = "Sorry, couldn't log you in. Try again."
- end
-
- redirect_to :action => 'index'
- end
-
- def logout
- # delete the username from the session hash
- session[:username] = nil
- session[:approvals] = nil
- redirect_to :action => 'index'
- end
-
-end
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/app/controllers/server_controller.rb b/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/app/controllers/server_controller.rb
deleted file mode 100644
index af0b1a7c..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/app/controllers/server_controller.rb
+++ /dev/null
@@ -1,265 +0,0 @@
-require 'pathname'
-
-# load the openid library, first trying rubygems
-#begin
-# require "rubygems"
-# require_gem "ruby-openid", ">= 1.0"
-#rescue LoadError
-require "openid"
-require "openid/consumer/discovery"
-require 'openid/extensions/sreg'
-require 'openid/extensions/pape'
-require 'openid/store/filesystem'
-#end
-
-class ServerController < ApplicationController
-
- include ServerHelper
- include OpenID::Server
- layout nil
-
- def index
- begin
- oidreq = server.decode_request(params)
- rescue ProtocolError => e
- # invalid openid request, so just display a page with an error message
- render :text => e.to_s, :status => 500
- return
- end
-
- # no openid.mode was given
- unless oidreq
- render :text => "This is an OpenID server endpoint."
- return
- end
-
- oidresp = nil
-
- if oidreq.kind_of?(CheckIDRequest)
-
- identity = oidreq.identity
-
- if oidreq.id_select
- if oidreq.immediate
- oidresp = oidreq.answer(false)
- elsif session[:username].nil?
- # The user hasn't logged in.
- show_decision_page(oidreq)
- return
- else
- # Else, set the identity to the one the user is using.
- identity = url_for_user
- end
- end
-
- if oidresp
- nil
- elsif self.is_authorized(identity, oidreq.trust_root)
- oidresp = oidreq.answer(true, nil, identity)
-
- # add the sreg response if requested
- add_sreg(oidreq, oidresp)
- # ditto pape
- add_pape(oidreq, oidresp)
-
- elsif oidreq.immediate
- server_url = url_for :action => 'index'
- oidresp = oidreq.answer(false, server_url)
-
- else
- show_decision_page(oidreq)
- return
- end
-
- else
- oidresp = server.handle_request(oidreq)
- end
-
- self.render_response(oidresp)
- end
-
- def show_decision_page(oidreq, message="Do you trust this site with your identity?")
- session[:last_oidreq] = oidreq
- @oidreq = oidreq
-
- if message
- flash[:notice] = message
- end
-
- render :template => 'server/decide', :layout => 'server'
- end
-
- def user_page
- # Yadis content-negotiation: we want to return the xrds if asked for.
- accept = request.env['HTTP_ACCEPT']
-
- # This is not technically correct, and should eventually be updated
- # to do real Accept header parsing and logic. Though I expect it will work
- # 99% of the time.
- if accept and accept.include?('application/xrds+xml')
- user_xrds
- return
- end
-
- # content negotiation failed, so just render the user page
- xrds_url = url_for(:controller=>'user',:action=>params[:username])+'/xrds'
- identity_page = <
-
-
-OpenID identity page for #{params[:username]}
-
-EOS
-
- # Also add the Yadis location header, so that they don't have
- # to parse the html unless absolutely necessary.
- response.headers['X-XRDS-Location'] = xrds_url
- render :text => identity_page
- end
-
- def user_xrds
- types = [
- OpenID::OPENID_2_0_TYPE,
- OpenID::OPENID_1_0_TYPE,
- OpenID::SREG_URI,
- ]
-
- render_xrds(types)
- end
-
- def idp_xrds
- types = [
- OpenID::OPENID_IDP_2_0_TYPE,
- ]
-
- render_xrds(types)
- end
-
- def decision
- oidreq = session[:last_oidreq]
- session[:last_oidreq] = nil
-
- if params[:yes].nil?
- redirect_to oidreq.cancel_url
- return
- else
- id_to_send = params[:id_to_send]
-
- identity = oidreq.identity
- if oidreq.id_select
- if id_to_send and id_to_send != ""
- session[:username] = id_to_send
- session[:approvals] = []
- identity = url_for_user
- else
- msg = "You must enter a username to in order to send " +
- "an identifier to the Relying Party."
- show_decision_page(oidreq, msg)
- return
- end
- end
-
- if session[:approvals]
- session[:approvals] << oidreq.trust_root
- else
- session[:approvals] = [oidreq.trust_root]
- end
- oidresp = oidreq.answer(true, nil, identity)
- add_sreg(oidreq, oidresp)
- add_pape(oidreq, oidresp)
- return self.render_response(oidresp)
- end
- end
-
- protected
-
- def server
- if @server.nil?
- server_url = url_for :action => 'index', :only_path => false
- dir = Pathname.new(RAILS_ROOT).join('db').join('openid-store')
- store = OpenID::Store::Filesystem.new(dir)
- @server = Server.new(store, server_url)
- end
- return @server
- end
-
- def approved(trust_root)
- return false if session[:approvals].nil?
- return session[:approvals].member?(trust_root)
- end
-
- def is_authorized(identity_url, trust_root)
- return (session[:username] and (identity_url == url_for_user) and self.approved(trust_root))
- end
-
- def render_xrds(types)
- type_str = ""
-
- types.each { |uri|
- type_str += "#{uri}\n "
- }
-
- yadis = <
-
-
-
- #{type_str}
- #{url_for(:controller => 'server', :only_path => false)}
-
-
-
-EOS
-
- response.headers['content-type'] = 'application/xrds+xml'
- render :text => yadis
- end
-
- def add_sreg(oidreq, oidresp)
- # check for Simple Registration arguments and respond
- sregreq = OpenID::SReg::Request.from_openid_request(oidreq)
-
- return if sregreq.nil?
- # In a real application, this data would be user-specific,
- # and the user should be asked for permission to release
- # it.
- sreg_data = {
- 'nickname' => session[:username],
- 'fullname' => 'Mayor McCheese',
- 'email' => 'mayor@example.com'
- }
-
- sregresp = OpenID::SReg::Response.extract_response(sregreq, sreg_data)
- oidresp.add_extension(sregresp)
- end
-
- def add_pape(oidreq, oidresp)
- papereq = OpenID::PAPE::Request.from_openid_request(oidreq)
- return if papereq.nil?
- paperesp = OpenID::PAPE::Response.new
- paperesp.nist_auth_level = 0 # we don't even do auth at all!
- oidresp.add_extension(paperesp)
- end
-
- def render_response(oidresp)
- if oidresp.needs_signing
- signed_response = server.signatory.sign(oidresp)
- end
- web_response = server.encode_response(oidresp)
-
- case web_response.code
- when HTTP_OK
- render :text => web_response.body, :status => 200
-
- when HTTP_REDIRECT
- redirect_to web_response.headers['location']
-
- else
- render :text => web_response.body, :status => 400
- end
- end
-
-
-end
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/app/helpers/application_helper.rb b/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/app/helpers/application_helper.rb
deleted file mode 100644
index 22a7940e..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/app/helpers/application_helper.rb
+++ /dev/null
@@ -1,3 +0,0 @@
-# Methods added to this helper will be available to all templates in the application.
-module ApplicationHelper
-end
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/app/helpers/login_helper.rb b/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/app/helpers/login_helper.rb
deleted file mode 100644
index a0418e32..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/app/helpers/login_helper.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-module LoginHelper
-end
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/app/helpers/server_helper.rb b/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/app/helpers/server_helper.rb
deleted file mode 100644
index 409b2104..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/app/helpers/server_helper.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-
-module ServerHelper
-
- def url_for_user
- url_for :controller => 'user', :action => session[:username]
- end
-
-end
-
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/app/views/consumer/index.rhtml b/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/app/views/consumer/index.rhtml
deleted file mode 100644
index 0cecbe8e..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/app/views/consumer/index.rhtml
+++ /dev/null
@@ -1,81 +0,0 @@
-
-
-Rails OpenID Example Relying Party
-
-
-
- Rails OpenID Example Relying Party
- <% if flash[:alert] %>
-
- <%= h(flash[:alert]) %>
-
- <% end %>
- <% if flash[:error] %>
-
- <%= h(flash[:error]) %>
-
- <% end %>
- <% if flash[:success] %>
-
- <%= h(flash[:success]) %>
-
- <% end %>
- <% if flash[:sreg_results] %>
-
- <%= flash[:sreg_results] %>
-
- <% end %>
- <% if flash[:pape_results] %>
-
- <%= flash[:pape_results] %>
-
- <% end %>
-
-
-
-
-
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/app/views/layouts/server.rhtml b/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/app/views/layouts/server.rhtml
deleted file mode 100644
index 3dd5d786..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/app/views/layouts/server.rhtml
+++ /dev/null
@@ -1,68 +0,0 @@
-
- OpenID Server Example
-
-
-
-
-
- <% if session[:username] %>
-
- Welcome, <%= session[:username] %> | <%= link_to('Log out', :controller => 'login', :action => 'logout') %>
- <%= @base_url %>user/<%= session[:username] %>
-
- <% end %>
-
- Ruby OpenID Server Example
-
-
-
- <% if flash[:notice] or flash[:error] %>
-
- <%= flash[:error] or flash[:notice] %>
-
- <% end %>
-
- <%= @content_for_layout %>
-
-
-
-
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/app/views/login/index.rhtml b/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/app/views/login/index.rhtml
deleted file mode 100644
index 9990a575..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/app/views/login/index.rhtml
+++ /dev/null
@@ -1,56 +0,0 @@
-
-
-<% if session[:username].nil? %>
-
-
-
-
-
-
-<% end %>
-
- Welcome to the Ruby OpenID example. This code is a starting point
-for developers wishing to implement an OpenID provider or relying
-party. We've used the Rails
-platform to demonstrate, but the library code is not Rails specific.
-
-To use the example provider
-
-
-
- - Enter a username in the form above. You will be "Logged In"
- to the server, at which point you may authenticate using an OpenID
- consumer. Your OpenID URL will be displayed after you log
- in.
The server will automatically create an identity page for
- you at <%= @base_url %>user/name
-
- Because WEBrick can only handle one thing at a time, you'll need to
- run another instance of the example on another port if you want to use
- a relying party to use with this example provider:
-
- script/server --port=3001
-
-
- (The RP needs to be able to access the provider, so unless you're
- running this example on a public IP, you can't use the live example
- at openidenabled.com on
- your local provider.)
-
-
- - Point your browser to this new instance and follow the directions
- below.
-
-
-
-
-
-To use the example relying party
-
-Visit /consumer
-and enter your OpenID.
-
-
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/app/views/server/decide.rhtml b/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/app/views/server/decide.rhtml
deleted file mode 100644
index 5322b48a..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/app/views/server/decide.rhtml
+++ /dev/null
@@ -1,26 +0,0 @@
-
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/config/boot.rb b/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/config/boot.rb
deleted file mode 100644
index 9fcd50fe..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/config/boot.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# Don't change this file. Configuration is done in config/environment.rb and config/environments/*.rb
-
-unless defined?(RAILS_ROOT)
- root_path = File.join(File.dirname(__FILE__), '..')
- unless RUBY_PLATFORM =~ /mswin32/
- require 'pathname'
- root_path = Pathname.new(root_path).cleanpath(true).to_s
- end
- RAILS_ROOT = root_path
-end
-
-if File.directory?("#{RAILS_ROOT}/vendor/rails")
- require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
-else
- require 'rubygems'
- require 'initializer'
-end
-
-Rails::Initializer.run(:set_load_path)
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/config/database.yml b/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/config/database.yml
deleted file mode 100644
index 1b2eb82d..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/config/database.yml
+++ /dev/null
@@ -1,74 +0,0 @@
-# MySQL (default setup). Versions 4.1 and 5.0 are recommended.
-#
-# Get the fast C bindings:
-# gem install mysql
-# (on OS X: gem install mysql -- --include=/usr/local/lib)
-# And be sure to use new-style password hashing:
-# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
-development:
- adapter: sqlite3
- database: db/development.sqlite3
-
-# Warning: The database defined as 'test' will be erased and
-# re-generated from your development database when you run 'rake'.
-# Do not set this db to the same as development or production.
-test:
- adapter: sqlite3
- database: ":memory:"
-
-production:
- adapter: mysql
- database: rails_server_production
- username: root
- password:
- socket: /path/to/your/mysql.sock
-
-
-# PostgreSQL versions 7.4 - 8.1
-#
-# Get the C bindings:
-# gem install postgres
-# or use the pure-Ruby bindings on Windows:
-# gem install postgres-pr
-postgresql_example:
- adapter: postgresql
- database: rails_server_development
- username: rails_server
- password:
-
- # Connect on a TCP socket. Omitted by default since the client uses a
- # domain socket that doesn't need configuration.
- #host: remote-database
- #port: 5432
-
- # Schema search path. The server defaults to $user,public
- #schema_search_path: myapp,sharedapp,public
-
- # Character set encoding. The server defaults to sql_ascii.
- #encoding: UTF8
-
- # Minimum log levels, in increasing order:
- # debug5, debug4, debug3, debug2, debug1,
- # info, notice, warning, error, log, fatal, or panic
- # The server defaults to notice.
- #min_messages: warning
-
-
-# SQLite version 2.x
-# gem install sqlite-ruby
-sqlite_example:
- adapter: sqlite
- database: db/development.sqlite2
-
-
-# SQLite version 3.x
-# gem install sqlite3-ruby
-sqlite3_example:
- adapter: sqlite3
- database: db/development.sqlite3
-
-
-# In-memory SQLite 3 database. Useful for tests.
-sqlite3_in_memory_example:
- adapter: sqlite3
- database: ":memory:"
\ No newline at end of file
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/config/environment.rb b/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/config/environment.rb
deleted file mode 100644
index 0a78bf83..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/config/environment.rb
+++ /dev/null
@@ -1,54 +0,0 @@
-# Be sure to restart your web server when you modify this file.
-
-# Uncomment below to force Rails into production mode when
-# you don't control web/app server and can't set it the proper way
-# ENV['RAILS_ENV'] ||= 'production'
-
-# Bootstrap the Rails environment, frameworks, and default configuration
-require File.join(File.dirname(__FILE__), 'boot')
-
-Rails::Initializer.run do |config|
- # Settings in config/environments/* take precedence those specified here
-
- # Skip frameworks you're not going to use
- # config.frameworks -= [ :action_web_service, :action_mailer ]
-
- # Add additional load paths for your own custom dirs
- # config.load_paths += %W( #{RAILS_ROOT}/extras )
-
- # Force all environments to use the same logger level
- # (by default production uses :info, the others :debug)
- # config.log_level = :debug
-
- # Use the database for sessions instead of the file system
- # (create the session table with 'rake create_sessions_table')
- # config.action_controller.session_store = :active_record_store
-
- # Enable page/fragment caching by setting a file-based store
- # (remember to create the caching directory and make it readable to the application)
- # config.action_controller.fragment_cache_store = :file_store, "#{RAILS_ROOT}/cache"
-
- # Activate observers that should always be running
- # config.active_record.observers = :cacher, :garbage_collector
-
- # Make Active Record use UTC-base instead of local time
- # config.active_record.default_timezone = :utc
-
- # Use Active Record's schema dumper instead of SQL when creating the test database
- # (enables use of different database adapters for development and test environments)
- # config.active_record.schema_format = :ruby
-
- # See Rails::Configuration for more options
-end
-
-# Add new inflection rules using the following format
-# (all these examples are active by default):
-# Inflector.inflections do |inflect|
-# inflect.plural /^(ox)$/i, '\1en'
-# inflect.singular /^(ox)en/i, '\1'
-# inflect.irregular 'person', 'people'
-# inflect.uncountable %w( fish sheep )
-# end
-
-# Include your application configuration below
-ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS[:session_key] = '_session_id_2'
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/config/environments/development.rb b/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/config/environments/development.rb
deleted file mode 100644
index 04b77920..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/config/environments/development.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# Settings specified here will take precedence over those in config/environment.rb
-
-# In the development environment your application's code is reloaded on
-# every request. This slows down response time but is perfect for development
-# since you don't have to restart the webserver when you make code changes.
-config.cache_classes = false
-
-# Log error messages when you accidentally call methods on nil.
-config.whiny_nils = true
-
-# Enable the breakpoint server that script/breakpointer connects to
-config.breakpoint_server = true
-
-# Show full error reports and disable caching
-config.action_controller.consider_all_requests_local = true
-config.action_controller.perform_caching = false
-
-# Don't care if the mailer can't send
-config.action_mailer.raise_delivery_errors = false
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/config/environments/production.rb b/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/config/environments/production.rb
deleted file mode 100644
index c9a4396c..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/config/environments/production.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# Settings specified here will take precedence over those in config/environment.rb
-
-# The production environment is meant for finished, "live" apps.
-# Code is not reloaded between requests
-config.cache_classes = true
-
-# Use a different logger for distributed setups
-# config.logger = SyslogLogger.new
-
-
-# Full error reports are disabled and caching is turned on
-config.action_controller.consider_all_requests_local = false
-config.action_controller.perform_caching = true
-
-# Enable serving of images, stylesheets, and javascripts from an asset server
-# config.action_controller.asset_host = "http://assets.example.com"
-
-# Disable delivery errors if you bad email addresses should just be ignored
-# config.action_mailer.raise_delivery_errors = false
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/config/environments/test.rb b/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/config/environments/test.rb
deleted file mode 100644
index 6a4cddbd..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/config/environments/test.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# Settings specified here will take precedence over those in config/environment.rb
-
-# The test environment is used exclusively to run your application's
-# test suite. You never need to work with it otherwise. Remember that
-# your test database is "scratch space" for the test suite and is wiped
-# and recreated between test runs. Don't rely on the data there!
-config.cache_classes = true
-
-# Log error messages when you accidentally call methods on nil.
-config.whiny_nils = true
-
-# Show full error reports and disable caching
-config.action_controller.consider_all_requests_local = true
-config.action_controller.perform_caching = false
-
-# Tell ActionMailer not to deliver emails to the real world.
-# The :test delivery method accumulates sent emails in the
-# ActionMailer::Base.deliveries array.
-config.action_mailer.delivery_method = :test
\ No newline at end of file
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/config/routes.rb b/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/config/routes.rb
deleted file mode 100644
index d5ceed20..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/config/routes.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-ActionController::Routing::Routes.draw do |map|
- # Add your own custom routes here.
- # The priority is based upon order of creation: first created -> highest priority.
-
- # Here's a sample route:
- # map.connect 'products/:id', :controller => 'catalog', :action => 'view'
- # Keep in mind you can assign values other than :controller and :action
-
- # You can have the root of your site routed by hooking up ''
- # -- just remember to delete public/index.html.
- # map.connect '', :controller => "welcome"
-
- map.connect '', :controller => 'login'
- map.connect 'server/xrds', :controller => 'server', :action => 'idp_xrds'
- map.connect 'user/:username', :controller => 'server', :action => 'user_page'
- map.connect 'user/:username/xrds', :controller => 'server', :action => 'user_xrds'
-
- # Allow downloading Web Service WSDL as a file with an extension
- # instead of a file named 'wsdl'
- map.connect ':controller/service.wsdl', :action => 'wsdl'
-
- # Install the default route as the lowest priority.
- map.connect ':controller/:action/:id'
-end
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/doc/README_FOR_APP b/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/doc/README_FOR_APP
deleted file mode 100644
index ac6c1491..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/doc/README_FOR_APP
+++ /dev/null
@@ -1,2 +0,0 @@
-Use this README file to introduce your application and point to useful places in the API for learning more.
-Run "rake appdoc" to generate API documentation for your models and controllers.
\ No newline at end of file
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/public/404.html b/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/public/404.html
deleted file mode 100644
index 0e184561..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/public/404.html
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
- File not found
- Change this error message for pages not found in public/404.html
-
-
\ No newline at end of file
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/public/500.html b/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/public/500.html
deleted file mode 100644
index a1001a00..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/public/500.html
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
- Application error (Apache)
- Change this error message for exceptions thrown outside of an action (like in Dispatcher setups or broken Ruby code) in public/500.html
-
-
\ No newline at end of file
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/public/dispatch.cgi b/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/public/dispatch.cgi
deleted file mode 100644
index dfe5dc30..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/public/dispatch.cgi
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/usr/bin/ruby1.8
-
-#!/usr/local/bin/ruby
-
-require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
-
-# If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like:
-# "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired
-require "dispatcher"
-
-ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) } if defined?(Apache::RubyRun)
-Dispatcher.dispatch
\ No newline at end of file
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/public/dispatch.fcgi b/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/public/dispatch.fcgi
deleted file mode 100644
index d02c35b8..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/public/dispatch.fcgi
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/ruby1.8
-
-#!/usr/local/bin/ruby
-#
-# You may specify the path to the FastCGI crash log (a log of unhandled
-# exceptions which forced the FastCGI instance to exit, great for debugging)
-# and the number of requests to process before running garbage collection.
-#
-# By default, the FastCGI crash log is RAILS_ROOT/log/fastcgi.crash.log
-# and the GC period is nil (turned off). A reasonable number of requests
-# could range from 10-100 depending on the memory footprint of your app.
-#
-# Example:
-# # Default log path, normal GC behavior.
-# RailsFCGIHandler.process!
-#
-# # Default log path, 50 requests between GC.
-# RailsFCGIHandler.process! nil, 50
-#
-# # Custom log path, normal GC behavior.
-# RailsFCGIHandler.process! '/var/log/myapp_fcgi_crash.log'
-#
-require File.dirname(__FILE__) + "/../config/environment"
-require 'fcgi_handler'
-
-RailsFCGIHandler.process!
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/public/dispatch.rb b/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/public/dispatch.rb
deleted file mode 100644
index dfe5dc30..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/public/dispatch.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/usr/bin/ruby1.8
-
-#!/usr/local/bin/ruby
-
-require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
-
-# If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like:
-# "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired
-require "dispatcher"
-
-ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) } if defined?(Apache::RubyRun)
-Dispatcher.dispatch
\ No newline at end of file
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/public/favicon.ico b/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/public/favicon.ico
deleted file mode 100644
index e69de29b..00000000
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/public/images/openid_login_bg.gif b/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/public/images/openid_login_bg.gif
deleted file mode 100644
index cde836c8..00000000
Binary files a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/public/images/openid_login_bg.gif and /dev/null differ
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/public/javascripts/controls.js b/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/public/javascripts/controls.js
deleted file mode 100644
index 9742b691..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/public/javascripts/controls.js
+++ /dev/null
@@ -1,750 +0,0 @@
-// Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
-// (c) 2005 Ivan Krstic (http://blogs.law.harvard.edu/ivan)
-// (c) 2005 Jon Tirsen (http://www.tirsen.com)
-// Contributors:
-// Richard Livsey
-// Rahul Bhargava
-// Rob Wills
-//
-// See scriptaculous.js for full license.
-
-// Autocompleter.Base handles all the autocompletion functionality
-// that's independent of the data source for autocompletion. This
-// includes drawing the autocompletion menu, observing keyboard
-// and mouse events, and similar.
-//
-// Specific autocompleters need to provide, at the very least,
-// a getUpdatedChoices function that will be invoked every time
-// the text inside the monitored textbox changes. This method
-// should get the text for which to provide autocompletion by
-// invoking this.getToken(), NOT by directly accessing
-// this.element.value. This is to allow incremental tokenized
-// autocompletion. Specific auto-completion logic (AJAX, etc)
-// belongs in getUpdatedChoices.
-//
-// Tokenized incremental autocompletion is enabled automatically
-// when an autocompleter is instantiated with the 'tokens' option
-// in the options parameter, e.g.:
-// new Ajax.Autocompleter('id','upd', '/url/', { tokens: ',' });
-// will incrementally autocomplete with a comma as the token.
-// Additionally, ',' in the above example can be replaced with
-// a token array, e.g. { tokens: [',', '\n'] } which
-// enables autocompletion on multiple tokens. This is most
-// useful when one of the tokens is \n (a newline), as it
-// allows smart autocompletion after linebreaks.
-
-var Autocompleter = {}
-Autocompleter.Base = function() {};
-Autocompleter.Base.prototype = {
- baseInitialize: function(element, update, options) {
- this.element = $(element);
- this.update = $(update);
- this.hasFocus = false;
- this.changed = false;
- this.active = false;
- this.index = 0;
- this.entryCount = 0;
-
- if (this.setOptions)
- this.setOptions(options);
- else
- this.options = options || {};
-
- this.options.paramName = this.options.paramName || this.element.name;
- this.options.tokens = this.options.tokens || [];
- this.options.frequency = this.options.frequency || 0.4;
- this.options.minChars = this.options.minChars || 1;
- this.options.onShow = this.options.onShow ||
- function(element, update){
- if(!update.style.position || update.style.position=='absolute') {
- update.style.position = 'absolute';
- Position.clone(element, update, {setHeight: false, offsetTop: element.offsetHeight});
- }
- Effect.Appear(update,{duration:0.15});
- };
- this.options.onHide = this.options.onHide ||
- function(element, update){ new Effect.Fade(update,{duration:0.15}) };
-
- if (typeof(this.options.tokens) == 'string')
- this.options.tokens = new Array(this.options.tokens);
-
- this.observer = null;
-
- this.element.setAttribute('autocomplete','off');
-
- Element.hide(this.update);
-
- Event.observe(this.element, "blur", this.onBlur.bindAsEventListener(this));
- Event.observe(this.element, "keypress", this.onKeyPress.bindAsEventListener(this));
- },
-
- show: function() {
- if(Element.getStyle(this.update, 'display')=='none') this.options.onShow(this.element, this.update);
- if(!this.iefix &&
- (navigator.appVersion.indexOf('MSIE')>0) &&
- (navigator.userAgent.indexOf('Opera')<0) &&
- (Element.getStyle(this.update, 'position')=='absolute')) {
- new Insertion.After(this.update,
- '');
- this.iefix = $(this.update.id+'_iefix');
- }
- if(this.iefix) setTimeout(this.fixIEOverlapping.bind(this), 50);
- },
-
- fixIEOverlapping: function() {
- Position.clone(this.update, this.iefix);
- this.iefix.style.zIndex = 1;
- this.update.style.zIndex = 2;
- Element.show(this.iefix);
- },
-
- hide: function() {
- this.stopIndicator();
- if(Element.getStyle(this.update, 'display')!='none') this.options.onHide(this.element, this.update);
- if(this.iefix) Element.hide(this.iefix);
- },
-
- startIndicator: function() {
- if(this.options.indicator) Element.show(this.options.indicator);
- },
-
- stopIndicator: function() {
- if(this.options.indicator) Element.hide(this.options.indicator);
- },
-
- onKeyPress: function(event) {
- if(this.active)
- switch(event.keyCode) {
- case Event.KEY_TAB:
- case Event.KEY_RETURN:
- this.selectEntry();
- Event.stop(event);
- case Event.KEY_ESC:
- this.hide();
- this.active = false;
- Event.stop(event);
- return;
- case Event.KEY_LEFT:
- case Event.KEY_RIGHT:
- return;
- case Event.KEY_UP:
- this.markPrevious();
- this.render();
- if(navigator.appVersion.indexOf('AppleWebKit')>0) Event.stop(event);
- return;
- case Event.KEY_DOWN:
- this.markNext();
- this.render();
- if(navigator.appVersion.indexOf('AppleWebKit')>0) Event.stop(event);
- return;
- }
- else
- if(event.keyCode==Event.KEY_TAB || event.keyCode==Event.KEY_RETURN)
- return;
-
- this.changed = true;
- this.hasFocus = true;
-
- if(this.observer) clearTimeout(this.observer);
- this.observer =
- setTimeout(this.onObserverEvent.bind(this), this.options.frequency*1000);
- },
-
- onHover: function(event) {
- var element = Event.findElement(event, 'LI');
- if(this.index != element.autocompleteIndex)
- {
- this.index = element.autocompleteIndex;
- this.render();
- }
- Event.stop(event);
- },
-
- onClick: function(event) {
- var element = Event.findElement(event, 'LI');
- this.index = element.autocompleteIndex;
- this.selectEntry();
- this.hide();
- },
-
- onBlur: function(event) {
- // needed to make click events working
- setTimeout(this.hide.bind(this), 250);
- this.hasFocus = false;
- this.active = false;
- },
-
- render: function() {
- if(this.entryCount > 0) {
- for (var i = 0; i < this.entryCount; i++)
- this.index==i ?
- Element.addClassName(this.getEntry(i),"selected") :
- Element.removeClassName(this.getEntry(i),"selected");
-
- if(this.hasFocus) {
- this.show();
- this.active = true;
- }
- } else {
- this.active = false;
- this.hide();
- }
- },
-
- markPrevious: function() {
- if(this.index > 0) this.index--
- else this.index = this.entryCount-1;
- },
-
- markNext: function() {
- if(this.index < this.entryCount-1) this.index++
- else this.index = 0;
- },
-
- getEntry: function(index) {
- return this.update.firstChild.childNodes[index];
- },
-
- getCurrentEntry: function() {
- return this.getEntry(this.index);
- },
-
- selectEntry: function() {
- this.active = false;
- this.updateElement(this.getCurrentEntry());
- },
-
- updateElement: function(selectedElement) {
- if (this.options.updateElement) {
- this.options.updateElement(selectedElement);
- return;
- }
-
- var value = Element.collectTextNodesIgnoreClass(selectedElement, 'informal');
- var lastTokenPos = this.findLastToken();
- if (lastTokenPos != -1) {
- var newValue = this.element.value.substr(0, lastTokenPos + 1);
- var whitespace = this.element.value.substr(lastTokenPos + 1).match(/^\s+/);
- if (whitespace)
- newValue += whitespace[0];
- this.element.value = newValue + value;
- } else {
- this.element.value = value;
- }
- this.element.focus();
-
- if (this.options.afterUpdateElement)
- this.options.afterUpdateElement(this.element, selectedElement);
- },
-
- updateChoices: function(choices) {
- if(!this.changed && this.hasFocus) {
- this.update.innerHTML = choices;
- Element.cleanWhitespace(this.update);
- Element.cleanWhitespace(this.update.firstChild);
-
- if(this.update.firstChild && this.update.firstChild.childNodes) {
- this.entryCount =
- this.update.firstChild.childNodes.length;
- for (var i = 0; i < this.entryCount; i++) {
- var entry = this.getEntry(i);
- entry.autocompleteIndex = i;
- this.addObservers(entry);
- }
- } else {
- this.entryCount = 0;
- }
-
- this.stopIndicator();
-
- this.index = 0;
- this.render();
- }
- },
-
- addObservers: function(element) {
- Event.observe(element, "mouseover", this.onHover.bindAsEventListener(this));
- Event.observe(element, "click", this.onClick.bindAsEventListener(this));
- },
-
- onObserverEvent: function() {
- this.changed = false;
- if(this.getToken().length>=this.options.minChars) {
- this.startIndicator();
- this.getUpdatedChoices();
- } else {
- this.active = false;
- this.hide();
- }
- },
-
- getToken: function() {
- var tokenPos = this.findLastToken();
- if (tokenPos != -1)
- var ret = this.element.value.substr(tokenPos + 1).replace(/^\s+/,'').replace(/\s+$/,'');
- else
- var ret = this.element.value;
-
- return /\n/.test(ret) ? '' : ret;
- },
-
- findLastToken: function() {
- var lastTokenPos = -1;
-
- for (var i=0; i lastTokenPos)
- lastTokenPos = thisTokenPos;
- }
- return lastTokenPos;
- }
-}
-
-Ajax.Autocompleter = Class.create();
-Object.extend(Object.extend(Ajax.Autocompleter.prototype, Autocompleter.Base.prototype), {
- initialize: function(element, update, url, options) {
- this.baseInitialize(element, update, options);
- this.options.asynchronous = true;
- this.options.onComplete = this.onComplete.bind(this);
- this.options.defaultParams = this.options.parameters || null;
- this.url = url;
- },
-
- getUpdatedChoices: function() {
- entry = encodeURIComponent(this.options.paramName) + '=' +
- encodeURIComponent(this.getToken());
-
- this.options.parameters = this.options.callback ?
- this.options.callback(this.element, entry) : entry;
-
- if(this.options.defaultParams)
- this.options.parameters += '&' + this.options.defaultParams;
-
- new Ajax.Request(this.url, this.options);
- },
-
- onComplete: function(request) {
- this.updateChoices(request.responseText);
- }
-
-});
-
-// The local array autocompleter. Used when you'd prefer to
-// inject an array of autocompletion options into the page, rather
-// than sending out Ajax queries, which can be quite slow sometimes.
-//
-// The constructor takes four parameters. The first two are, as usual,
-// the id of the monitored textbox, and id of the autocompletion menu.
-// The third is the array you want to autocomplete from, and the fourth
-// is the options block.
-//
-// Extra local autocompletion options:
-// - choices - How many autocompletion choices to offer
-//
-// - partialSearch - If false, the autocompleter will match entered
-// text only at the beginning of strings in the
-// autocomplete array. Defaults to true, which will
-// match text at the beginning of any *word* in the
-// strings in the autocomplete array. If you want to
-// search anywhere in the string, additionally set
-// the option fullSearch to true (default: off).
-//
-// - fullSsearch - Search anywhere in autocomplete array strings.
-//
-// - partialChars - How many characters to enter before triggering
-// a partial match (unlike minChars, which defines
-// how many characters are required to do any match
-// at all). Defaults to 2.
-//
-// - ignoreCase - Whether to ignore case when autocompleting.
-// Defaults to true.
-//
-// It's possible to pass in a custom function as the 'selector'
-// option, if you prefer to write your own autocompletion logic.
-// In that case, the other options above will not apply unless
-// you support them.
-
-Autocompleter.Local = Class.create();
-Autocompleter.Local.prototype = Object.extend(new Autocompleter.Base(), {
- initialize: function(element, update, array, options) {
- this.baseInitialize(element, update, options);
- this.options.array = array;
- },
-
- getUpdatedChoices: function() {
- this.updateChoices(this.options.selector(this));
- },
-
- setOptions: function(options) {
- this.options = Object.extend({
- choices: 10,
- partialSearch: true,
- partialChars: 2,
- ignoreCase: true,
- fullSearch: false,
- selector: function(instance) {
- var ret = []; // Beginning matches
- var partial = []; // Inside matches
- var entry = instance.getToken();
- var count = 0;
-
- for (var i = 0; i < instance.options.array.length &&
- ret.length < instance.options.choices ; i++) {
-
- var elem = instance.options.array[i];
- var foundPos = instance.options.ignoreCase ?
- elem.toLowerCase().indexOf(entry.toLowerCase()) :
- elem.indexOf(entry);
-
- while (foundPos != -1) {
- if (foundPos == 0 && elem.length != entry.length) {
- ret.push("" + elem.substr(0, entry.length) + "" +
- elem.substr(entry.length) + "");
- break;
- } else if (entry.length >= instance.options.partialChars &&
- instance.options.partialSearch && foundPos != -1) {
- if (instance.options.fullSearch || /\s/.test(elem.substr(foundPos-1,1))) {
- partial.push("" + elem.substr(0, foundPos) + "" +
- elem.substr(foundPos, entry.length) + "" + elem.substr(
- foundPos + entry.length) + "");
- break;
- }
- }
-
- foundPos = instance.options.ignoreCase ?
- elem.toLowerCase().indexOf(entry.toLowerCase(), foundPos + 1) :
- elem.indexOf(entry, foundPos + 1);
-
- }
- }
- if (partial.length)
- ret = ret.concat(partial.slice(0, instance.options.choices - ret.length))
- return "";
- }
- }, options || {});
- }
-});
-
-// AJAX in-place editor
-//
-// see documentation on http://wiki.script.aculo.us/scriptaculous/show/Ajax.InPlaceEditor
-
-// Use this if you notice weird scrolling problems on some browsers,
-// the DOM might be a bit confused when this gets called so do this
-// waits 1 ms (with setTimeout) until it does the activation
-Field.scrollFreeActivate = function(field) {
- setTimeout(function() {
- Field.activate(field);
- }, 1);
-}
-
-Ajax.InPlaceEditor = Class.create();
-Ajax.InPlaceEditor.defaultHighlightColor = "#FFFF99";
-Ajax.InPlaceEditor.prototype = {
- initialize: function(element, url, options) {
- this.url = url;
- this.element = $(element);
-
- this.options = Object.extend({
- okText: "ok",
- cancelText: "cancel",
- savingText: "Saving...",
- clickToEditText: "Click to edit",
- okText: "ok",
- rows: 1,
- onComplete: function(transport, element) {
- new Effect.Highlight(element, {startcolor: this.options.highlightcolor});
- },
- onFailure: function(transport) {
- alert("Error communicating with the server: " + transport.responseText.stripTags());
- },
- callback: function(form) {
- return Form.serialize(form);
- },
- handleLineBreaks: true,
- loadingText: 'Loading...',
- savingClassName: 'inplaceeditor-saving',
- loadingClassName: 'inplaceeditor-loading',
- formClassName: 'inplaceeditor-form',
- highlightcolor: Ajax.InPlaceEditor.defaultHighlightColor,
- highlightendcolor: "#FFFFFF",
- externalControl: null,
- ajaxOptions: {}
- }, options || {});
-
- if(!this.options.formId && this.element.id) {
- this.options.formId = this.element.id + "-inplaceeditor";
- if ($(this.options.formId)) {
- // there's already a form with that name, don't specify an id
- this.options.formId = null;
- }
- }
-
- if (this.options.externalControl) {
- this.options.externalControl = $(this.options.externalControl);
- }
-
- this.originalBackground = Element.getStyle(this.element, 'background-color');
- if (!this.originalBackground) {
- this.originalBackground = "transparent";
- }
-
- this.element.title = this.options.clickToEditText;
-
- this.onclickListener = this.enterEditMode.bindAsEventListener(this);
- this.mouseoverListener = this.enterHover.bindAsEventListener(this);
- this.mouseoutListener = this.leaveHover.bindAsEventListener(this);
- Event.observe(this.element, 'click', this.onclickListener);
- Event.observe(this.element, 'mouseover', this.mouseoverListener);
- Event.observe(this.element, 'mouseout', this.mouseoutListener);
- if (this.options.externalControl) {
- Event.observe(this.options.externalControl, 'click', this.onclickListener);
- Event.observe(this.options.externalControl, 'mouseover', this.mouseoverListener);
- Event.observe(this.options.externalControl, 'mouseout', this.mouseoutListener);
- }
- },
- enterEditMode: function(evt) {
- if (this.saving) return;
- if (this.editing) return;
- this.editing = true;
- this.onEnterEditMode();
- if (this.options.externalControl) {
- Element.hide(this.options.externalControl);
- }
- Element.hide(this.element);
- this.createForm();
- this.element.parentNode.insertBefore(this.form, this.element);
- Field.scrollFreeActivate(this.editField);
- // stop the event to avoid a page refresh in Safari
- if (evt) {
- Event.stop(evt);
- }
- return false;
- },
- createForm: function() {
- this.form = document.createElement("form");
- this.form.id = this.options.formId;
- Element.addClassName(this.form, this.options.formClassName)
- this.form.onsubmit = this.onSubmit.bind(this);
-
- this.createEditField();
-
- if (this.options.textarea) {
- var br = document.createElement("br");
- this.form.appendChild(br);
- }
-
- okButton = document.createElement("input");
- okButton.type = "submit";
- okButton.value = this.options.okText;
- this.form.appendChild(okButton);
-
- cancelLink = document.createElement("a");
- cancelLink.href = "#";
- cancelLink.appendChild(document.createTextNode(this.options.cancelText));
- cancelLink.onclick = this.onclickCancel.bind(this);
- this.form.appendChild(cancelLink);
- },
- hasHTMLLineBreaks: function(string) {
- if (!this.options.handleLineBreaks) return false;
- return string.match(/
/i);
- },
- convertHTMLLineBreaks: function(string) {
- return string.replace(/
/gi, "\n").replace(/
/gi, "\n").replace(/<\/p>/gi, "\n").replace(//gi, "");
- },
- createEditField: function() {
- var text;
- if(this.options.loadTextURL) {
- text = this.options.loadingText;
- } else {
- text = this.getText();
- }
-
- if (this.options.rows == 1 && !this.hasHTMLLineBreaks(text)) {
- this.options.textarea = false;
- var textField = document.createElement("input");
- textField.type = "text";
- textField.name = "value";
- textField.value = text;
- textField.style.backgroundColor = this.options.highlightcolor;
- var size = this.options.size || this.options.cols || 0;
- if (size != 0) textField.size = size;
- this.editField = textField;
- } else {
- this.options.textarea = true;
- var textArea = document.createElement("textarea");
- textArea.name = "value";
- textArea.value = this.convertHTMLLineBreaks(text);
- textArea.rows = this.options.rows;
- textArea.cols = this.options.cols || 40;
- this.editField = textArea;
- }
-
- if(this.options.loadTextURL) {
- this.loadExternalText();
- }
- this.form.appendChild(this.editField);
- },
- getText: function() {
- return this.element.innerHTML;
- },
- loadExternalText: function() {
- Element.addClassName(this.form, this.options.loadingClassName);
- this.editField.disabled = true;
- new Ajax.Request(
- this.options.loadTextURL,
- Object.extend({
- asynchronous: true,
- onComplete: this.onLoadedExternalText.bind(this)
- }, this.options.ajaxOptions)
- );
- },
- onLoadedExternalText: function(transport) {
- Element.removeClassName(this.form, this.options.loadingClassName);
- this.editField.disabled = false;
- this.editField.value = transport.responseText.stripTags();
- },
- onclickCancel: function() {
- this.onComplete();
- this.leaveEditMode();
- return false;
- },
- onFailure: function(transport) {
- this.options.onFailure(transport);
- if (this.oldInnerHTML) {
- this.element.innerHTML = this.oldInnerHTML;
- this.oldInnerHTML = null;
- }
- return false;
- },
- onSubmit: function() {
- // onLoading resets these so we need to save them away for the Ajax call
- var form = this.form;
- var value = this.editField.value;
-
- // do this first, sometimes the ajax call returns before we get a chance to switch on Saving...
- // which means this will actually switch on Saving... *after* we've left edit mode causing Saving...
- // to be displayed indefinitely
- this.onLoading();
-
- new Ajax.Updater(
- {
- success: this.element,
- // don't update on failure (this could be an option)
- failure: null
- },
- this.url,
- Object.extend({
- parameters: this.options.callback(form, value),
- onComplete: this.onComplete.bind(this),
- onFailure: this.onFailure.bind(this)
- }, this.options.ajaxOptions)
- );
- // stop the event to avoid a page refresh in Safari
- if (arguments.length > 1) {
- Event.stop(arguments[0]);
- }
- return false;
- },
- onLoading: function() {
- this.saving = true;
- this.removeForm();
- this.leaveHover();
- this.showSaving();
- },
- showSaving: function() {
- this.oldInnerHTML = this.element.innerHTML;
- this.element.innerHTML = this.options.savingText;
- Element.addClassName(this.element, this.options.savingClassName);
- this.element.style.backgroundColor = this.originalBackground;
- Element.show(this.element);
- },
- removeForm: function() {
- if(this.form) {
- if (this.form.parentNode) Element.remove(this.form);
- this.form = null;
- }
- },
- enterHover: function() {
- if (this.saving) return;
- this.element.style.backgroundColor = this.options.highlightcolor;
- if (this.effect) {
- this.effect.cancel();
- }
- Element.addClassName(this.element, this.options.hoverClassName)
- },
- leaveHover: function() {
- if (this.options.backgroundColor) {
- this.element.style.backgroundColor = this.oldBackground;
- }
- Element.removeClassName(this.element, this.options.hoverClassName)
- if (this.saving) return;
- this.effect = new Effect.Highlight(this.element, {
- startcolor: this.options.highlightcolor,
- endcolor: this.options.highlightendcolor,
- restorecolor: this.originalBackground
- });
- },
- leaveEditMode: function() {
- Element.removeClassName(this.element, this.options.savingClassName);
- this.removeForm();
- this.leaveHover();
- this.element.style.backgroundColor = this.originalBackground;
- Element.show(this.element);
- if (this.options.externalControl) {
- Element.show(this.options.externalControl);
- }
- this.editing = false;
- this.saving = false;
- this.oldInnerHTML = null;
- this.onLeaveEditMode();
- },
- onComplete: function(transport) {
- this.leaveEditMode();
- this.options.onComplete.bind(this)(transport, this.element);
- },
- onEnterEditMode: function() {},
- onLeaveEditMode: function() {},
- dispose: function() {
- if (this.oldInnerHTML) {
- this.element.innerHTML = this.oldInnerHTML;
- }
- this.leaveEditMode();
- Event.stopObserving(this.element, 'click', this.onclickListener);
- Event.stopObserving(this.element, 'mouseover', this.mouseoverListener);
- Event.stopObserving(this.element, 'mouseout', this.mouseoutListener);
- if (this.options.externalControl) {
- Event.stopObserving(this.options.externalControl, 'click', this.onclickListener);
- Event.stopObserving(this.options.externalControl, 'mouseover', this.mouseoverListener);
- Event.stopObserving(this.options.externalControl, 'mouseout', this.mouseoutListener);
- }
- }
-};
-
-// Delayed observer, like Form.Element.Observer,
-// but waits for delay after last key input
-// Ideal for live-search fields
-
-Form.Element.DelayedObserver = Class.create();
-Form.Element.DelayedObserver.prototype = {
- initialize: function(element, delay, callback) {
- this.delay = delay || 0.5;
- this.element = $(element);
- this.callback = callback;
- this.timer = null;
- this.lastValue = $F(this.element);
- Event.observe(this.element,'keyup',this.delayedListener.bindAsEventListener(this));
- },
- delayedListener: function(event) {
- if(this.lastValue == $F(this.element)) return;
- if(this.timer) clearTimeout(this.timer);
- this.timer = setTimeout(this.onTimerEvent.bind(this), this.delay * 1000);
- this.lastValue = $F(this.element);
- },
- onTimerEvent: function() {
- this.timer = null;
- this.callback(this.element, $F(this.element));
- }
-};
\ No newline at end of file
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/public/javascripts/dragdrop.js b/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/public/javascripts/dragdrop.js
deleted file mode 100644
index 92d1f731..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/public/javascripts/dragdrop.js
+++ /dev/null
@@ -1,584 +0,0 @@
-// Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
-//
-// See scriptaculous.js for full license.
-
-/*--------------------------------------------------------------------------*/
-
-var Droppables = {
- drops: [],
-
- remove: function(element) {
- this.drops = this.drops.reject(function(d) { return d.element==$(element) });
- },
-
- add: function(element) {
- element = $(element);
- var options = Object.extend({
- greedy: true,
- hoverclass: null
- }, arguments[1] || {});
-
- // cache containers
- if(options.containment) {
- options._containers = [];
- var containment = options.containment;
- if((typeof containment == 'object') &&
- (containment.constructor == Array)) {
- containment.each( function(c) { options._containers.push($(c)) });
- } else {
- options._containers.push($(containment));
- }
- }
-
- if(options.accept) options.accept = [options.accept].flatten();
-
- Element.makePositioned(element); // fix IE
- options.element = element;
-
- this.drops.push(options);
- },
-
- isContained: function(element, drop) {
- var parentNode = element.parentNode;
- return drop._containers.detect(function(c) { return parentNode == c });
- },
-
- isAffected: function(point, element, drop) {
- return (
- (drop.element!=element) &&
- ((!drop._containers) ||
- this.isContained(element, drop)) &&
- ((!drop.accept) ||
- (Element.classNames(element).detect(
- function(v) { return drop.accept.include(v) } ) )) &&
- Position.within(drop.element, point[0], point[1]) );
- },
-
- deactivate: function(drop) {
- if(drop.hoverclass)
- Element.removeClassName(drop.element, drop.hoverclass);
- this.last_active = null;
- },
-
- activate: function(drop) {
- if(drop.hoverclass)
- Element.addClassName(drop.element, drop.hoverclass);
- this.last_active = drop;
- },
-
- show: function(point, element) {
- if(!this.drops.length) return;
-
- if(this.last_active) this.deactivate(this.last_active);
- this.drops.each( function(drop) {
- if(Droppables.isAffected(point, element, drop)) {
- if(drop.onHover)
- drop.onHover(element, drop.element, Position.overlap(drop.overlap, drop.element));
- if(drop.greedy) {
- Droppables.activate(drop);
- throw $break;
- }
- }
- });
- },
-
- fire: function(event, element) {
- if(!this.last_active) return;
- Position.prepare();
-
- if (this.isAffected([Event.pointerX(event), Event.pointerY(event)], element, this.last_active))
- if (this.last_active.onDrop)
- this.last_active.onDrop(element, this.last_active.element, event);
- },
-
- reset: function() {
- if(this.last_active)
- this.deactivate(this.last_active);
- }
-}
-
-var Draggables = {
- drags: [],
- observers: [],
-
- register: function(draggable) {
- if(this.drags.length == 0) {
- this.eventMouseUp = this.endDrag.bindAsEventListener(this);
- this.eventMouseMove = this.updateDrag.bindAsEventListener(this);
- this.eventKeypress = this.keyPress.bindAsEventListener(this);
-
- Event.observe(document, "mouseup", this.eventMouseUp);
- Event.observe(document, "mousemove", this.eventMouseMove);
- Event.observe(document, "keypress", this.eventKeypress);
- }
- this.drags.push(draggable);
- },
-
- unregister: function(draggable) {
- this.drags = this.drags.reject(function(d) { return d==draggable });
- if(this.drags.length == 0) {
- Event.stopObserving(document, "mouseup", this.eventMouseUp);
- Event.stopObserving(document, "mousemove", this.eventMouseMove);
- Event.stopObserving(document, "keypress", this.eventKeypress);
- }
- },
-
- activate: function(draggable) {
- window.focus(); // allows keypress events if window isn't currently focused, fails for Safari
- this.activeDraggable = draggable;
- },
-
- deactivate: function(draggbale) {
- this.activeDraggable = null;
- },
-
- updateDrag: function(event) {
- if(!this.activeDraggable) return;
- var pointer = [Event.pointerX(event), Event.pointerY(event)];
- // Mozilla-based browsers fire successive mousemove events with
- // the same coordinates, prevent needless redrawing (moz bug?)
- if(this._lastPointer && (this._lastPointer.inspect() == pointer.inspect())) return;
- this._lastPointer = pointer;
- this.activeDraggable.updateDrag(event, pointer);
- },
-
- endDrag: function(event) {
- if(!this.activeDraggable) return;
- this._lastPointer = null;
- this.activeDraggable.endDrag(event);
- },
-
- keyPress: function(event) {
- if(this.activeDraggable)
- this.activeDraggable.keyPress(event);
- },
-
- addObserver: function(observer) {
- this.observers.push(observer);
- this._cacheObserverCallbacks();
- },
-
- removeObserver: function(element) { // element instead of observer fixes mem leaks
- this.observers = this.observers.reject( function(o) { return o.element==element });
- this._cacheObserverCallbacks();
- },
-
- notify: function(eventName, draggable, event) { // 'onStart', 'onEnd', 'onDrag'
- if(this[eventName+'Count'] > 0)
- this.observers.each( function(o) {
- if(o[eventName]) o[eventName](eventName, draggable, event);
- });
- },
-
- _cacheObserverCallbacks: function() {
- ['onStart','onEnd','onDrag'].each( function(eventName) {
- Draggables[eventName+'Count'] = Draggables.observers.select(
- function(o) { return o[eventName]; }
- ).length;
- });
- }
-}
-
-/*--------------------------------------------------------------------------*/
-
-var Draggable = Class.create();
-Draggable.prototype = {
- initialize: function(element) {
- var options = Object.extend({
- handle: false,
- starteffect: function(element) {
- new Effect.Opacity(element, {duration:0.2, from:1.0, to:0.7});
- },
- reverteffect: function(element, top_offset, left_offset) {
- var dur = Math.sqrt(Math.abs(top_offset^2)+Math.abs(left_offset^2))*0.02;
- element._revert = new Effect.MoveBy(element, -top_offset, -left_offset, {duration:dur});
- },
- endeffect: function(element) {
- new Effect.Opacity(element, {duration:0.2, from:0.7, to:1.0});
- },
- zindex: 1000,
- revert: false,
- snap: false // false, or xy or [x,y] or function(x,y){ return [x,y] }
- }, arguments[1] || {});
-
- this.element = $(element);
-
- if(options.handle && (typeof options.handle == 'string'))
- this.handle = Element.childrenWithClassName(this.element, options.handle)[0];
- if(!this.handle) this.handle = $(options.handle);
- if(!this.handle) this.handle = this.element;
-
- Element.makePositioned(this.element); // fix IE
-
- this.delta = this.currentDelta();
- this.options = options;
- this.dragging = false;
-
- this.eventMouseDown = this.initDrag.bindAsEventListener(this);
- Event.observe(this.handle, "mousedown", this.eventMouseDown);
-
- Draggables.register(this);
- },
-
- destroy: function() {
- Event.stopObserving(this.handle, "mousedown", this.eventMouseDown);
- Draggables.unregister(this);
- },
-
- currentDelta: function() {
- return([
- parseInt(this.element.style.left || '0'),
- parseInt(this.element.style.top || '0')]);
- },
-
- initDrag: function(event) {
- if(Event.isLeftClick(event)) {
- // abort on form elements, fixes a Firefox issue
- var src = Event.element(event);
- if(src.tagName && (
- src.tagName=='INPUT' ||
- src.tagName=='SELECT' ||
- src.tagName=='BUTTON' ||
- src.tagName=='TEXTAREA')) return;
-
- if(this.element._revert) {
- this.element._revert.cancel();
- this.element._revert = null;
- }
-
- var pointer = [Event.pointerX(event), Event.pointerY(event)];
- var pos = Position.cumulativeOffset(this.element);
- this.offset = [0,1].map( function(i) { return (pointer[i] - pos[i]) });
-
- Draggables.activate(this);
- Event.stop(event);
- }
- },
-
- startDrag: function(event) {
- this.dragging = true;
-
- if(this.options.zindex) {
- this.originalZ = parseInt(Element.getStyle(this.element,'z-index') || 0);
- this.element.style.zIndex = this.options.zindex;
- }
-
- if(this.options.ghosting) {
- this._clone = this.element.cloneNode(true);
- Position.absolutize(this.element);
- this.element.parentNode.insertBefore(this._clone, this.element);
- }
-
- Draggables.notify('onStart', this, event);
- if(this.options.starteffect) this.options.starteffect(this.element);
- },
-
- updateDrag: function(event, pointer) {
- if(!this.dragging) this.startDrag(event);
- Position.prepare();
- Droppables.show(pointer, this.element);
- Draggables.notify('onDrag', this, event);
- this.draw(pointer);
- if(this.options.change) this.options.change(this);
-
- // fix AppleWebKit rendering
- if(navigator.appVersion.indexOf('AppleWebKit')>0) window.scrollBy(0,0);
- Event.stop(event);
- },
-
- finishDrag: function(event, success) {
- this.dragging = false;
-
- if(this.options.ghosting) {
- Position.relativize(this.element);
- Element.remove(this._clone);
- this._clone = null;
- }
-
- if(success) Droppables.fire(event, this.element);
- Draggables.notify('onEnd', this, event);
-
- var revert = this.options.revert;
- if(revert && typeof revert == 'function') revert = revert(this.element);
-
- var d = this.currentDelta();
- if(revert && this.options.reverteffect) {
- this.options.reverteffect(this.element,
- d[1]-this.delta[1], d[0]-this.delta[0]);
- } else {
- this.delta = d;
- }
-
- if(this.options.zindex)
- this.element.style.zIndex = this.originalZ;
-
- if(this.options.endeffect)
- this.options.endeffect(this.element);
-
- Draggables.deactivate(this);
- Droppables.reset();
- },
-
- keyPress: function(event) {
- if(!event.keyCode==Event.KEY_ESC) return;
- this.finishDrag(event, false);
- Event.stop(event);
- },
-
- endDrag: function(event) {
- if(!this.dragging) return;
- this.finishDrag(event, true);
- Event.stop(event);
- },
-
- draw: function(point) {
- var pos = Position.cumulativeOffset(this.element);
- var d = this.currentDelta();
- pos[0] -= d[0]; pos[1] -= d[1];
-
- var p = [0,1].map(function(i){ return (point[i]-pos[i]-this.offset[i]) }.bind(this));
-
- if(this.options.snap) {
- if(typeof this.options.snap == 'function') {
- p = this.options.snap(p[0],p[1]);
- } else {
- if(this.options.snap instanceof Array) {
- p = p.map( function(v, i) {
- return Math.round(v/this.options.snap[i])*this.options.snap[i] }.bind(this))
- } else {
- p = p.map( function(v) {
- return Math.round(v/this.options.snap)*this.options.snap }.bind(this))
- }
- }}
-
- var style = this.element.style;
- if((!this.options.constraint) || (this.options.constraint=='horizontal'))
- style.left = p[0] + "px";
- if((!this.options.constraint) || (this.options.constraint=='vertical'))
- style.top = p[1] + "px";
- if(style.visibility=="hidden") style.visibility = ""; // fix gecko rendering
- }
-}
-
-/*--------------------------------------------------------------------------*/
-
-var SortableObserver = Class.create();
-SortableObserver.prototype = {
- initialize: function(element, observer) {
- this.element = $(element);
- this.observer = observer;
- this.lastValue = Sortable.serialize(this.element);
- },
-
- onStart: function() {
- this.lastValue = Sortable.serialize(this.element);
- },
-
- onEnd: function() {
- Sortable.unmark();
- if(this.lastValue != Sortable.serialize(this.element))
- this.observer(this.element)
- }
-}
-
-var Sortable = {
- sortables: new Array(),
-
- options: function(element){
- element = $(element);
- return this.sortables.detect(function(s) { return s.element == element });
- },
-
- destroy: function(element){
- element = $(element);
- this.sortables.findAll(function(s) { return s.element == element }).each(function(s){
- Draggables.removeObserver(s.element);
- s.droppables.each(function(d){ Droppables.remove(d) });
- s.draggables.invoke('destroy');
- });
- this.sortables = this.sortables.reject(function(s) { return s.element == element });
- },
-
- create: function(element) {
- element = $(element);
- var options = Object.extend({
- element: element,
- tag: 'li', // assumes li children, override with tag: 'tagname'
- dropOnEmpty: false,
- tree: false, // fixme: unimplemented
- overlap: 'vertical', // one of 'vertical', 'horizontal'
- constraint: 'vertical', // one of 'vertical', 'horizontal', false
- containment: element, // also takes array of elements (or id's); or false
- handle: false, // or a CSS class
- only: false,
- hoverclass: null,
- ghosting: false,
- format: null,
- onChange: Prototype.emptyFunction,
- onUpdate: Prototype.emptyFunction
- }, arguments[1] || {});
-
- // clear any old sortable with same element
- this.destroy(element);
-
- // build options for the draggables
- var options_for_draggable = {
- revert: true,
- ghosting: options.ghosting,
- constraint: options.constraint,
- handle: options.handle };
-
- if(options.starteffect)
- options_for_draggable.starteffect = options.starteffect;
-
- if(options.reverteffect)
- options_for_draggable.reverteffect = options.reverteffect;
- else
- if(options.ghosting) options_for_draggable.reverteffect = function(element) {
- element.style.top = 0;
- element.style.left = 0;
- };
-
- if(options.endeffect)
- options_for_draggable.endeffect = options.endeffect;
-
- if(options.zindex)
- options_for_draggable.zindex = options.zindex;
-
- // build options for the droppables
- var options_for_droppable = {
- overlap: options.overlap,
- containment: options.containment,
- hoverclass: options.hoverclass,
- onHover: Sortable.onHover,
- greedy: !options.dropOnEmpty
- }
-
- // fix for gecko engine
- Element.cleanWhitespace(element);
-
- options.draggables = [];
- options.droppables = [];
-
- // make it so
-
- // drop on empty handling
- if(options.dropOnEmpty) {
- Droppables.add(element,
- {containment: options.containment, onHover: Sortable.onEmptyHover, greedy: false});
- options.droppables.push(element);
- }
-
- (this.findElements(element, options) || []).each( function(e) {
- // handles are per-draggable
- var handle = options.handle ?
- Element.childrenWithClassName(e, options.handle)[0] : e;
- options.draggables.push(
- new Draggable(e, Object.extend(options_for_draggable, { handle: handle })));
- Droppables.add(e, options_for_droppable);
- options.droppables.push(e);
- });
-
- // keep reference
- this.sortables.push(options);
-
- // for onupdate
- Draggables.addObserver(new SortableObserver(element, options.onUpdate));
-
- },
-
- // return all suitable-for-sortable elements in a guaranteed order
- findElements: function(element, options) {
- if(!element.hasChildNodes()) return null;
- var elements = [];
- $A(element.childNodes).each( function(e) {
- if(e.tagName && e.tagName.toUpperCase()==options.tag.toUpperCase() &&
- (!options.only || (Element.hasClassName(e, options.only))))
- elements.push(e);
- if(options.tree) {
- var grandchildren = this.findElements(e, options);
- if(grandchildren) elements.push(grandchildren);
- }
- });
-
- return (elements.length>0 ? elements.flatten() : null);
- },
-
- onHover: function(element, dropon, overlap) {
- if(overlap>0.5) {
- Sortable.mark(dropon, 'before');
- if(dropon.previousSibling != element) {
- var oldParentNode = element.parentNode;
- element.style.visibility = "hidden"; // fix gecko rendering
- dropon.parentNode.insertBefore(element, dropon);
- if(dropon.parentNode!=oldParentNode)
- Sortable.options(oldParentNode).onChange(element);
- Sortable.options(dropon.parentNode).onChange(element);
- }
- } else {
- Sortable.mark(dropon, 'after');
- var nextElement = dropon.nextSibling || null;
- if(nextElement != element) {
- var oldParentNode = element.parentNode;
- element.style.visibility = "hidden"; // fix gecko rendering
- dropon.parentNode.insertBefore(element, nextElement);
- if(dropon.parentNode!=oldParentNode)
- Sortable.options(oldParentNode).onChange(element);
- Sortable.options(dropon.parentNode).onChange(element);
- }
- }
- },
-
- onEmptyHover: function(element, dropon) {
- if(element.parentNode!=dropon) {
- var oldParentNode = element.parentNode;
- dropon.appendChild(element);
- Sortable.options(oldParentNode).onChange(element);
- Sortable.options(dropon).onChange(element);
- }
- },
-
- unmark: function() {
- if(Sortable._marker) Element.hide(Sortable._marker);
- },
-
- mark: function(dropon, position) {
- // mark on ghosting only
- var sortable = Sortable.options(dropon.parentNode);
- if(sortable && !sortable.ghosting) return;
-
- if(!Sortable._marker) {
- Sortable._marker = $('dropmarker') || document.createElement('DIV');
- Element.hide(Sortable._marker);
- Element.addClassName(Sortable._marker, 'dropmarker');
- Sortable._marker.style.position = 'absolute';
- document.getElementsByTagName("body").item(0).appendChild(Sortable._marker);
- }
- var offsets = Position.cumulativeOffset(dropon);
- Sortable._marker.style.left = offsets[0] + 'px';
- Sortable._marker.style.top = offsets[1] + 'px';
-
- if(position=='after')
- if(sortable.overlap == 'horizontal')
- Sortable._marker.style.left = (offsets[0]+dropon.clientWidth) + 'px';
- else
- Sortable._marker.style.top = (offsets[1]+dropon.clientHeight) + 'px';
-
- Element.show(Sortable._marker);
- },
-
- serialize: function(element) {
- element = $(element);
- var sortableOptions = this.options(element);
- var options = Object.extend({
- tag: sortableOptions.tag,
- only: sortableOptions.only,
- name: element.id,
- format: sortableOptions.format || /^[^_]*_(.*)$/
- }, arguments[1] || {});
- return $(this.findElements(element, options) || []).map( function(item) {
- return (encodeURIComponent(options.name) + "[]=" +
- encodeURIComponent(item.id.match(options.format) ? item.id.match(options.format)[1] : ''));
- }).join("&");
- }
-}
\ No newline at end of file
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/public/javascripts/effects.js b/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/public/javascripts/effects.js
deleted file mode 100644
index 414398ce..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/public/javascripts/effects.js
+++ /dev/null
@@ -1,854 +0,0 @@
-// Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
-// Contributors:
-// Justin Palmer (http://encytemedia.com/)
-// Mark Pilgrim (http://diveintomark.org/)
-// Martin Bialasinki
-//
-// See scriptaculous.js for full license.
-
-/* ------------- element ext -------------- */
-
-// converts rgb() and #xxx to #xxxxxx format,
-// returns self (or first argument) if not convertable
-String.prototype.parseColor = function() {
- var color = '#';
- if(this.slice(0,4) == 'rgb(') {
- var cols = this.slice(4,this.length-1).split(',');
- var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3);
- } else {
- if(this.slice(0,1) == '#') {
- if(this.length==4) for(var i=1;i<4;i++) color += (this.charAt(i) + this.charAt(i)).toLowerCase();
- if(this.length==7) color = this.toLowerCase();
- }
- }
- return(color.length==7 ? color : (arguments[0] || this));
-}
-
-Element.collectTextNodesIgnoreClass = function(element, ignoreclass) {
- var children = $(element).childNodes;
- var text = '';
- var classtest = new RegExp('^([^ ]+ )*' + ignoreclass+ '( [^ ]+)*$','i');
-
- for (var i = 0; i < children.length; i++) {
- if(children[i].nodeType==3) {
- text+=children[i].nodeValue;
- } else {
- if((!children[i].className.match(classtest)) && children[i].hasChildNodes())
- text += Element.collectTextNodesIgnoreClass(children[i], ignoreclass);
- }
- }
-
- return text;
-}
-
-Element.setStyle = function(element, style) {
- element = $(element);
- for(k in style) element.style[k.camelize()] = style[k];
-}
-
-Element.setContentZoom = function(element, percent) {
- Element.setStyle(element, {fontSize: (percent/100) + 'em'});
- if(navigator.appVersion.indexOf('AppleWebKit')>0) window.scrollBy(0,0);
-}
-
-Element.getOpacity = function(element){
- var opacity;
- if (opacity = Element.getStyle(element, 'opacity'))
- return parseFloat(opacity);
- if (opacity = (Element.getStyle(element, 'filter') || '').match(/alpha\(opacity=(.*)\)/))
- if(opacity[1]) return parseFloat(opacity[1]) / 100;
- return 1.0;
-}
-
-Element.setOpacity = function(element, value){
- element= $(element);
- if (value == 1){
- Element.setStyle(element, { opacity:
- (/Gecko/.test(navigator.userAgent) && !/Konqueror|Safari|KHTML/.test(navigator.userAgent)) ?
- 0.999999 : null });
- if(/MSIE/.test(navigator.userAgent))
- Element.setStyle(element, {filter: Element.getStyle(element,'filter').replace(/alpha\([^\)]*\)/gi,'')});
- } else {
- if(value < 0.00001) value = 0;
- Element.setStyle(element, {opacity: value});
- if(/MSIE/.test(navigator.userAgent))
- Element.setStyle(element,
- { filter: Element.getStyle(element,'filter').replace(/alpha\([^\)]*\)/gi,'') +
- 'alpha(opacity='+value*100+')' });
- }
-}
-
-Element.getInlineOpacity = function(element){
- return $(element).style.opacity || '';
-}
-
-Element.childrenWithClassName = function(element, className) {
- return $A($(element).getElementsByTagName('*')).select(
- function(c) { return Element.hasClassName(c, className) });
-}
-
-Array.prototype.call = function() {
- var args = arguments;
- this.each(function(f){ f.apply(this, args) });
-}
-
-/*--------------------------------------------------------------------------*/
-
-var Effect = {
- tagifyText: function(element) {
- var tagifyStyle = 'position:relative';
- if(/MSIE/.test(navigator.userAgent)) tagifyStyle += ';zoom:1';
- element = $(element);
- $A(element.childNodes).each( function(child) {
- if(child.nodeType==3) {
- child.nodeValue.toArray().each( function(character) {
- element.insertBefore(
- Builder.node('span',{style: tagifyStyle},
- character == ' ' ? String.fromCharCode(160) : character),
- child);
- });
- Element.remove(child);
- }
- });
- },
- multiple: function(element, effect) {
- var elements;
- if(((typeof element == 'object') ||
- (typeof element == 'function')) &&
- (element.length))
- elements = element;
- else
- elements = $(element).childNodes;
-
- var options = Object.extend({
- speed: 0.1,
- delay: 0.0
- }, arguments[2] || {});
- var masterDelay = options.delay;
-
- $A(elements).each( function(element, index) {
- new effect(element, Object.extend(options, { delay: index * options.speed + masterDelay }));
- });
- }
-};
-
-var Effect2 = Effect; // deprecated
-
-/* ------------- transitions ------------- */
-
-Effect.Transitions = {}
-
-Effect.Transitions.linear = function(pos) {
- return pos;
-}
-Effect.Transitions.sinoidal = function(pos) {
- return (-Math.cos(pos*Math.PI)/2) + 0.5;
-}
-Effect.Transitions.reverse = function(pos) {
- return 1-pos;
-}
-Effect.Transitions.flicker = function(pos) {
- return ((-Math.cos(pos*Math.PI)/4) + 0.75) + Math.random()/4;
-}
-Effect.Transitions.wobble = function(pos) {
- return (-Math.cos(pos*Math.PI*(9*pos))/2) + 0.5;
-}
-Effect.Transitions.pulse = function(pos) {
- return (Math.floor(pos*10) % 2 == 0 ?
- (pos*10-Math.floor(pos*10)) : 1-(pos*10-Math.floor(pos*10)));
-}
-Effect.Transitions.none = function(pos) {
- return 0;
-}
-Effect.Transitions.full = function(pos) {
- return 1;
-}
-
-/* ------------- core effects ------------- */
-
-Effect.Queue = {
- effects: [],
- _each: function(iterator) {
- this.effects._each(iterator);
- },
- interval: null,
- add: function(effect) {
- var timestamp = new Date().getTime();
-
- switch(effect.options.queue) {
- case 'front':
- // move unstarted effects after this effect
- this.effects.findAll(function(e){ return e.state=='idle' }).each( function(e) {
- e.startOn += effect.finishOn;
- e.finishOn += effect.finishOn;
- });
- break;
- case 'end':
- // start effect after last queued effect has finished
- timestamp = this.effects.pluck('finishOn').max() || timestamp;
- break;
- }
-
- effect.startOn += timestamp;
- effect.finishOn += timestamp;
- this.effects.push(effect);
- if(!this.interval)
- this.interval = setInterval(this.loop.bind(this), 40);
- },
- remove: function(effect) {
- this.effects = this.effects.reject(function(e) { return e==effect });
- if(this.effects.length == 0) {
- clearInterval(this.interval);
- this.interval = null;
- }
- },
- loop: function() {
- var timePos = new Date().getTime();
- this.effects.invoke('loop', timePos);
- }
-}
-Object.extend(Effect.Queue, Enumerable);
-
-Effect.Base = function() {};
-Effect.Base.prototype = {
- position: null,
- setOptions: function(options) {
- this.options = Object.extend({
- transition: Effect.Transitions.sinoidal,
- duration: 1.0, // seconds
- fps: 25.0, // max. 25fps due to Effect.Queue implementation
- sync: false, // true for combining
- from: 0.0,
- to: 1.0,
- delay: 0.0,
- queue: 'parallel'
- }, options || {});
- },
- start: function(options) {
- this.setOptions(options || {});
- this.currentFrame = 0;
- this.state = 'idle';
- this.startOn = this.options.delay*1000;
- this.finishOn = this.startOn + (this.options.duration*1000);
- this.event('beforeStart');
- if(!this.options.sync) Effect.Queue.add(this);
- },
- loop: function(timePos) {
- if(timePos >= this.startOn) {
- if(timePos >= this.finishOn) {
- this.render(1.0);
- this.cancel();
- this.event('beforeFinish');
- if(this.finish) this.finish();
- this.event('afterFinish');
- return;
- }
- var pos = (timePos - this.startOn) / (this.finishOn - this.startOn);
- var frame = Math.round(pos * this.options.fps * this.options.duration);
- if(frame > this.currentFrame) {
- this.render(pos);
- this.currentFrame = frame;
- }
- }
- },
- render: function(pos) {
- if(this.state == 'idle') {
- this.state = 'running';
- this.event('beforeSetup');
- if(this.setup) this.setup();
- this.event('afterSetup');
- }
- if(this.state == 'running') {
- if(this.options.transition) pos = this.options.transition(pos);
- pos *= (this.options.to-this.options.from);
- pos += this.options.from;
- this.position = pos;
- this.event('beforeUpdate');
- if(this.update) this.update(pos);
- this.event('afterUpdate');
- }
- },
- cancel: function() {
- if(!this.options.sync) Effect.Queue.remove(this);
- this.state = 'finished';
- },
- event: function(eventName) {
- if(this.options[eventName + 'Internal']) this.options[eventName + 'Internal'](this);
- if(this.options[eventName]) this.options[eventName](this);
- },
- inspect: function() {
- return '#';
- }
-}
-
-Effect.Parallel = Class.create();
-Object.extend(Object.extend(Effect.Parallel.prototype, Effect.Base.prototype), {
- initialize: function(effects) {
- this.effects = effects || [];
- this.start(arguments[1]);
- },
- update: function(position) {
- this.effects.invoke('render', position);
- },
- finish: function(position) {
- this.effects.each( function(effect) {
- effect.render(1.0);
- effect.cancel();
- effect.event('beforeFinish');
- if(effect.finish) effect.finish(position);
- effect.event('afterFinish');
- });
- }
-});
-
-Effect.Opacity = Class.create();
-Object.extend(Object.extend(Effect.Opacity.prototype, Effect.Base.prototype), {
- initialize: function(element) {
- this.element = $(element);
- // make this work on IE on elements without 'layout'
- if(/MSIE/.test(navigator.userAgent) && (!this.element.hasLayout))
- Element.setStyle(this.element, {zoom: 1});
- var options = Object.extend({
- from: Element.getOpacity(this.element) || 0.0,
- to: 1.0
- }, arguments[1] || {});
- this.start(options);
- },
- update: function(position) {
- Element.setOpacity(this.element, position);
- }
-});
-
-Effect.MoveBy = Class.create();
-Object.extend(Object.extend(Effect.MoveBy.prototype, Effect.Base.prototype), {
- initialize: function(element, toTop, toLeft) {
- this.element = $(element);
- this.toTop = toTop;
- this.toLeft = toLeft;
- this.start(arguments[3]);
- },
- setup: function() {
- // Bug in Opera: Opera returns the "real" position of a static element or
- // relative element that does not have top/left explicitly set.
- // ==> Always set top and left for position relative elements in your stylesheets
- // (to 0 if you do not need them)
- Element.makePositioned(this.element);
- this.originalTop = parseFloat(Element.getStyle(this.element,'top') || '0');
- this.originalLeft = parseFloat(Element.getStyle(this.element,'left') || '0');
- },
- update: function(position) {
- Element.setStyle(this.element, {
- top: this.toTop * position + this.originalTop + 'px',
- left: this.toLeft * position + this.originalLeft + 'px'
- });
- }
-});
-
-Effect.Scale = Class.create();
-Object.extend(Object.extend(Effect.Scale.prototype, Effect.Base.prototype), {
- initialize: function(element, percent) {
- this.element = $(element)
- var options = Object.extend({
- scaleX: true,
- scaleY: true,
- scaleContent: true,
- scaleFromCenter: false,
- scaleMode: 'box', // 'box' or 'contents' or {} with provided values
- scaleFrom: 100.0,
- scaleTo: percent
- }, arguments[2] || {});
- this.start(options);
- },
- setup: function() {
- this.restoreAfterFinish = this.options.restoreAfterFinish || false;
- this.elementPositioning = Element.getStyle(this.element,'position');
-
- this.originalStyle = {};
- ['top','left','width','height','fontSize'].each( function(k) {
- this.originalStyle[k] = this.element.style[k];
- }.bind(this));
-
- this.originalTop = this.element.offsetTop;
- this.originalLeft = this.element.offsetLeft;
-
- var fontSize = Element.getStyle(this.element,'font-size') || '100%';
- ['em','px','%'].each( function(fontSizeType) {
- if(fontSize.indexOf(fontSizeType)>0) {
- this.fontSize = parseFloat(fontSize);
- this.fontSizeType = fontSizeType;
- }
- }.bind(this));
-
- this.factor = (this.options.scaleTo - this.options.scaleFrom)/100;
-
- this.dims = null;
- if(this.options.scaleMode=='box')
- this.dims = [this.element.offsetHeight, this.element.offsetWidth];
- if(/^content/.test(this.options.scaleMode))
- this.dims = [this.element.scrollHeight, this.element.scrollWidth];
- if(!this.dims)
- this.dims = [this.options.scaleMode.originalHeight,
- this.options.scaleMode.originalWidth];
- },
- update: function(position) {
- var currentScale = (this.options.scaleFrom/100.0) + (this.factor * position);
- if(this.options.scaleContent && this.fontSize)
- Element.setStyle(this.element, {fontSize: this.fontSize * currentScale + this.fontSizeType });
- this.setDimensions(this.dims[0] * currentScale, this.dims[1] * currentScale);
- },
- finish: function(position) {
- if (this.restoreAfterFinish) Element.setStyle(this.element, this.originalStyle);
- },
- setDimensions: function(height, width) {
- var d = {};
- if(this.options.scaleX) d.width = width + 'px';
- if(this.options.scaleY) d.height = height + 'px';
- if(this.options.scaleFromCenter) {
- var topd = (height - this.dims[0])/2;
- var leftd = (width - this.dims[1])/2;
- if(this.elementPositioning == 'absolute') {
- if(this.options.scaleY) d.top = this.originalTop-topd + 'px';
- if(this.options.scaleX) d.left = this.originalLeft-leftd + 'px';
- } else {
- if(this.options.scaleY) d.top = -topd + 'px';
- if(this.options.scaleX) d.left = -leftd + 'px';
- }
- }
- Element.setStyle(this.element, d);
- }
-});
-
-Effect.Highlight = Class.create();
-Object.extend(Object.extend(Effect.Highlight.prototype, Effect.Base.prototype), {
- initialize: function(element) {
- this.element = $(element);
- var options = Object.extend({ startcolor: '#ffff99' }, arguments[1] || {});
- this.start(options);
- },
- setup: function() {
- // Prevent executing on elements not in the layout flow
- if(Element.getStyle(this.element, 'display')=='none') { this.cancel(); return; }
- // Disable background image during the effect
- this.oldStyle = {
- backgroundImage: Element.getStyle(this.element, 'background-image') };
- Element.setStyle(this.element, {backgroundImage: 'none'});
- if(!this.options.endcolor)
- this.options.endcolor = Element.getStyle(this.element, 'background-color').parseColor('#ffffff');
- if(!this.options.restorecolor)
- this.options.restorecolor = Element.getStyle(this.element, 'background-color');
- // init color calculations
- this._base = $R(0,2).map(function(i){ return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16) }.bind(this));
- this._delta = $R(0,2).map(function(i){ return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i] }.bind(this));
- },
- update: function(position) {
- Element.setStyle(this.element,{backgroundColor: $R(0,2).inject('#',function(m,v,i){
- return m+(Math.round(this._base[i]+(this._delta[i]*position)).toColorPart()); }.bind(this)) });
- },
- finish: function() {
- Element.setStyle(this.element, Object.extend(this.oldStyle, {
- backgroundColor: this.options.restorecolor
- }));
- }
-});
-
-Effect.ScrollTo = Class.create();
-Object.extend(Object.extend(Effect.ScrollTo.prototype, Effect.Base.prototype), {
- initialize: function(element) {
- this.element = $(element);
- this.start(arguments[1] || {});
- },
- setup: function() {
- Position.prepare();
- var offsets = Position.cumulativeOffset(this.element);
- if(this.options.offset) offsets[1] += this.options.offset;
- var max = window.innerHeight ?
- window.height - window.innerHeight :
- document.body.scrollHeight -
- (document.documentElement.clientHeight ?
- document.documentElement.clientHeight : document.body.clientHeight);
- this.scrollStart = Position.deltaY;
- this.delta = (offsets[1] > max ? max : offsets[1]) - this.scrollStart;
- },
- update: function(position) {
- Position.prepare();
- window.scrollTo(Position.deltaX,
- this.scrollStart + (position*this.delta));
- }
-});
-
-/* ------------- combination effects ------------- */
-
-Effect.Fade = function(element) {
- var oldOpacity = Element.getInlineOpacity(element);
- var options = Object.extend({
- from: Element.getOpacity(element) || 1.0,
- to: 0.0,
- afterFinishInternal: function(effect) { with(Element) {
- if(effect.options.to!=0) return;
- hide(effect.element);
- setStyle(effect.element, {opacity: oldOpacity}); }}
- }, arguments[1] || {});
- return new Effect.Opacity(element,options);
-}
-
-Effect.Appear = function(element) {
- var options = Object.extend({
- from: (Element.getStyle(element, 'display') == 'none' ? 0.0 : Element.getOpacity(element) || 0.0),
- to: 1.0,
- beforeSetup: function(effect) { with(Element) {
- setOpacity(effect.element, effect.options.from);
- show(effect.element); }}
- }, arguments[1] || {});
- return new Effect.Opacity(element,options);
-}
-
-Effect.Puff = function(element) {
- element = $(element);
- var oldStyle = { opacity: Element.getInlineOpacity(element), position: Element.getStyle(element, 'position') };
- return new Effect.Parallel(
- [ new Effect.Scale(element, 200,
- { sync: true, scaleFromCenter: true, scaleContent: true, restoreAfterFinish: true }),
- new Effect.Opacity(element, { sync: true, to: 0.0 } ) ],
- Object.extend({ duration: 1.0,
- beforeSetupInternal: function(effect) { with(Element) {
- setStyle(effect.effects[0].element, {position: 'absolute'}); }},
- afterFinishInternal: function(effect) { with(Element) {
- hide(effect.effects[0].element);
- setStyle(effect.effects[0].element, oldStyle); }}
- }, arguments[1] || {})
- );
-}
-
-Effect.BlindUp = function(element) {
- element = $(element);
- Element.makeClipping(element);
- return new Effect.Scale(element, 0,
- Object.extend({ scaleContent: false,
- scaleX: false,
- restoreAfterFinish: true,
- afterFinishInternal: function(effect) { with(Element) {
- [hide, undoClipping].call(effect.element); }}
- }, arguments[1] || {})
- );
-}
-
-Effect.BlindDown = function(element) {
- element = $(element);
- var oldHeight = Element.getStyle(element, 'height');
- var elementDimensions = Element.getDimensions(element);
- return new Effect.Scale(element, 100,
- Object.extend({ scaleContent: false,
- scaleX: false,
- scaleFrom: 0,
- scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
- restoreAfterFinish: true,
- afterSetup: function(effect) { with(Element) {
- makeClipping(effect.element);
- setStyle(effect.element, {height: '0px'});
- show(effect.element);
- }},
- afterFinishInternal: function(effect) { with(Element) {
- undoClipping(effect.element);
- setStyle(effect.element, {height: oldHeight});
- }}
- }, arguments[1] || {})
- );
-}
-
-Effect.SwitchOff = function(element) {
- element = $(element);
- var oldOpacity = Element.getInlineOpacity(element);
- return new Effect.Appear(element, {
- duration: 0.4,
- from: 0,
- transition: Effect.Transitions.flicker,
- afterFinishInternal: function(effect) {
- new Effect.Scale(effect.element, 1, {
- duration: 0.3, scaleFromCenter: true,
- scaleX: false, scaleContent: false, restoreAfterFinish: true,
- beforeSetup: function(effect) { with(Element) {
- [makePositioned,makeClipping].call(effect.element);
- }},
- afterFinishInternal: function(effect) { with(Element) {
- [hide,undoClipping,undoPositioned].call(effect.element);
- setStyle(effect.element, {opacity: oldOpacity});
- }}
- })
- }
- });
-}
-
-Effect.DropOut = function(element) {
- element = $(element);
- var oldStyle = {
- top: Element.getStyle(element, 'top'),
- left: Element.getStyle(element, 'left'),
- opacity: Element.getInlineOpacity(element) };
- return new Effect.Parallel(
- [ new Effect.MoveBy(element, 100, 0, { sync: true }),
- new Effect.Opacity(element, { sync: true, to: 0.0 }) ],
- Object.extend(
- { duration: 0.5,
- beforeSetup: function(effect) { with(Element) {
- makePositioned(effect.effects[0].element); }},
- afterFinishInternal: function(effect) { with(Element) {
- [hide, undoPositioned].call(effect.effects[0].element);
- setStyle(effect.effects[0].element, oldStyle); }}
- }, arguments[1] || {}));
-}
-
-Effect.Shake = function(element) {
- element = $(element);
- var oldStyle = {
- top: Element.getStyle(element, 'top'),
- left: Element.getStyle(element, 'left') };
- return new Effect.MoveBy(element, 0, 20,
- { duration: 0.05, afterFinishInternal: function(effect) {
- new Effect.MoveBy(effect.element, 0, -40,
- { duration: 0.1, afterFinishInternal: function(effect) {
- new Effect.MoveBy(effect.element, 0, 40,
- { duration: 0.1, afterFinishInternal: function(effect) {
- new Effect.MoveBy(effect.element, 0, -40,
- { duration: 0.1, afterFinishInternal: function(effect) {
- new Effect.MoveBy(effect.element, 0, 40,
- { duration: 0.1, afterFinishInternal: function(effect) {
- new Effect.MoveBy(effect.element, 0, -20,
- { duration: 0.05, afterFinishInternal: function(effect) { with(Element) {
- undoPositioned(effect.element);
- setStyle(effect.element, oldStyle);
- }}}) }}) }}) }}) }}) }});
-}
-
-Effect.SlideDown = function(element) {
- element = $(element);
- Element.cleanWhitespace(element);
- // SlideDown need to have the content of the element wrapped in a container element with fixed height!
- var oldInnerBottom = Element.getStyle(element.firstChild, 'bottom');
- var elementDimensions = Element.getDimensions(element);
- return new Effect.Scale(element, 100, Object.extend({
- scaleContent: false,
- scaleX: false,
- scaleFrom: 0,
- scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
- restoreAfterFinish: true,
- afterSetup: function(effect) { with(Element) {
- makePositioned(effect.element);
- makePositioned(effect.element.firstChild);
- if(window.opera) setStyle(effect.element, {top: ''});
- makeClipping(effect.element);
- setStyle(effect.element, {height: '0px'});
- show(element); }},
- afterUpdateInternal: function(effect) { with(Element) {
- setStyle(effect.element.firstChild, {bottom:
- (effect.dims[0] - effect.element.clientHeight) + 'px' }); }},
- afterFinishInternal: function(effect) { with(Element) {
- undoClipping(effect.element);
- undoPositioned(effect.element.firstChild);
- undoPositioned(effect.element);
- setStyle(effect.element.firstChild, {bottom: oldInnerBottom}); }}
- }, arguments[1] || {})
- );
-}
-
-Effect.SlideUp = function(element) {
- element = $(element);
- Element.cleanWhitespace(element);
- var oldInnerBottom = Element.getStyle(element.firstChild, 'bottom');
- return new Effect.Scale(element, 0,
- Object.extend({ scaleContent: false,
- scaleX: false,
- scaleMode: 'box',
- scaleFrom: 100,
- restoreAfterFinish: true,
- beforeStartInternal: function(effect) { with(Element) {
- makePositioned(effect.element);
- makePositioned(effect.element.firstChild);
- if(window.opera) setStyle(effect.element, {top: ''});
- makeClipping(effect.element);
- show(element); }},
- afterUpdateInternal: function(effect) { with(Element) {
- setStyle(effect.element.firstChild, {bottom:
- (effect.dims[0] - effect.element.clientHeight) + 'px' }); }},
- afterFinishInternal: function(effect) { with(Element) {
- [hide, undoClipping].call(effect.element);
- undoPositioned(effect.element.firstChild);
- undoPositioned(effect.element);
- setStyle(effect.element.firstChild, {bottom: oldInnerBottom}); }}
- }, arguments[1] || {})
- );
-}
-
-// Bug in opera makes the TD containing this element expand for a instance after finish
-Effect.Squish = function(element) {
- return new Effect.Scale(element, window.opera ? 1 : 0,
- { restoreAfterFinish: true,
- beforeSetup: function(effect) { with(Element) {
- makeClipping(effect.element); }},
- afterFinishInternal: function(effect) { with(Element) {
- hide(effect.element);
- undoClipping(effect.element); }}
- });
-}
-
-Effect.Grow = function(element) {
- element = $(element);
- var options = Object.extend({
- direction: 'center',
- moveTransistion: Effect.Transitions.sinoidal,
- scaleTransition: Effect.Transitions.sinoidal,
- opacityTransition: Effect.Transitions.full
- }, arguments[1] || {});
- var oldStyle = {
- top: element.style.top,
- left: element.style.left,
- height: element.style.height,
- width: element.style.width,
- opacity: Element.getInlineOpacity(element) };
-
- var dims = Element.getDimensions(element);
- var initialMoveX, initialMoveY;
- var moveX, moveY;
-
- switch (options.direction) {
- case 'top-left':
- initialMoveX = initialMoveY = moveX = moveY = 0;
- break;
- case 'top-right':
- initialMoveX = dims.width;
- initialMoveY = moveY = 0;
- moveX = -dims.width;
- break;
- case 'bottom-left':
- initialMoveX = moveX = 0;
- initialMoveY = dims.height;
- moveY = -dims.height;
- break;
- case 'bottom-right':
- initialMoveX = dims.width;
- initialMoveY = dims.height;
- moveX = -dims.width;
- moveY = -dims.height;
- break;
- case 'center':
- initialMoveX = dims.width / 2;
- initialMoveY = dims.height / 2;
- moveX = -dims.width / 2;
- moveY = -dims.height / 2;
- break;
- }
-
- return new Effect.MoveBy(element, initialMoveY, initialMoveX, {
- duration: 0.01,
- beforeSetup: function(effect) { with(Element) {
- hide(effect.element);
- makeClipping(effect.element);
- makePositioned(effect.element);
- }},
- afterFinishInternal: function(effect) {
- new Effect.Parallel(
- [ new Effect.Opacity(effect.element, { sync: true, to: 1.0, from: 0.0, transition: options.opacityTransition }),
- new Effect.MoveBy(effect.element, moveY, moveX, { sync: true, transition: options.moveTransition }),
- new Effect.Scale(effect.element, 100, {
- scaleMode: { originalHeight: dims.height, originalWidth: dims.width },
- sync: true, scaleFrom: window.opera ? 1 : 0, transition: options.scaleTransition, restoreAfterFinish: true})
- ], Object.extend({
- beforeSetup: function(effect) { with(Element) {
- setStyle(effect.effects[0].element, {height: '0px'});
- show(effect.effects[0].element); }},
- afterFinishInternal: function(effect) { with(Element) {
- [undoClipping, undoPositioned].call(effect.effects[0].element);
- setStyle(effect.effects[0].element, oldStyle); }}
- }, options)
- )
- }
- });
-}
-
-Effect.Shrink = function(element) {
- element = $(element);
- var options = Object.extend({
- direction: 'center',
- moveTransistion: Effect.Transitions.sinoidal,
- scaleTransition: Effect.Transitions.sinoidal,
- opacityTransition: Effect.Transitions.none
- }, arguments[1] || {});
- var oldStyle = {
- top: element.style.top,
- left: element.style.left,
- height: element.style.height,
- width: element.style.width,
- opacity: Element.getInlineOpacity(element) };
-
- var dims = Element.getDimensions(element);
- var moveX, moveY;
-
- switch (options.direction) {
- case 'top-left':
- moveX = moveY = 0;
- break;
- case 'top-right':
- moveX = dims.width;
- moveY = 0;
- break;
- case 'bottom-left':
- moveX = 0;
- moveY = dims.height;
- break;
- case 'bottom-right':
- moveX = dims.width;
- moveY = dims.height;
- break;
- case 'center':
- moveX = dims.width / 2;
- moveY = dims.height / 2;
- break;
- }
-
- return new Effect.Parallel(
- [ new Effect.Opacity(element, { sync: true, to: 0.0, from: 1.0, transition: options.opacityTransition }),
- new Effect.Scale(element, window.opera ? 1 : 0, { sync: true, transition: options.scaleTransition, restoreAfterFinish: true}),
- new Effect.MoveBy(element, moveY, moveX, { sync: true, transition: options.moveTransition })
- ], Object.extend({
- beforeStartInternal: function(effect) { with(Element) {
- [makePositioned, makeClipping].call(effect.effects[0].element) }},
- afterFinishInternal: function(effect) { with(Element) {
- [hide, undoClipping, undoPositioned].call(effect.effects[0].element);
- setStyle(effect.effects[0].element, oldStyle); }}
- }, options)
- );
-}
-
-Effect.Pulsate = function(element) {
- element = $(element);
- var options = arguments[1] || {};
- var oldOpacity = Element.getInlineOpacity(element);
- var transition = options.transition || Effect.Transitions.sinoidal;
- var reverser = function(pos){ return transition(1-Effect.Transitions.pulse(pos)) };
- reverser.bind(transition);
- return new Effect.Opacity(element,
- Object.extend(Object.extend({ duration: 3.0, from: 0,
- afterFinishInternal: function(effect) { Element.setStyle(effect.element, {opacity: oldOpacity}); }
- }, options), {transition: reverser}));
-}
-
-Effect.Fold = function(element) {
- element = $(element);
- var oldStyle = {
- top: element.style.top,
- left: element.style.left,
- width: element.style.width,
- height: element.style.height };
- Element.makeClipping(element);
- return new Effect.Scale(element, 5, Object.extend({
- scaleContent: false,
- scaleX: false,
- afterFinishInternal: function(effect) {
- new Effect.Scale(element, 1, {
- scaleContent: false,
- scaleY: false,
- afterFinishInternal: function(effect) { with(Element) {
- [hide, undoClipping].call(effect.element);
- setStyle(effect.element, oldStyle);
- }} });
- }}, arguments[1] || {}));
-}
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/public/javascripts/prototype.js b/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/public/javascripts/prototype.js
deleted file mode 100644
index e9ccd3c8..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/public/javascripts/prototype.js
+++ /dev/null
@@ -1,1785 +0,0 @@
-/* Prototype JavaScript framework, version 1.4.0
- * (c) 2005 Sam Stephenson
- *
- * THIS FILE IS AUTOMATICALLY GENERATED. When sending patches, please diff
- * against the source tree, available from the Prototype darcs repository.
- *
- * Prototype is freely distributable under the terms of an MIT-style license.
- *
- * For details, see the Prototype web site: http://prototype.conio.net/
- *
-/*--------------------------------------------------------------------------*/
-
-var Prototype = {
- Version: '1.4.0',
- ScriptFragment: '(?:)((\n|\r|.)*?)(?:<\/script>)',
-
- emptyFunction: function() {},
- K: function(x) {return x}
-}
-
-var Class = {
- create: function() {
- return function() {
- this.initialize.apply(this, arguments);
- }
- }
-}
-
-var Abstract = new Object();
-
-Object.extend = function(destination, source) {
- for (property in source) {
- destination[property] = source[property];
- }
- return destination;
-}
-
-Object.inspect = function(object) {
- try {
- if (object == undefined) return 'undefined';
- if (object == null) return 'null';
- return object.inspect ? object.inspect() : object.toString();
- } catch (e) {
- if (e instanceof RangeError) return '...';
- throw e;
- }
-}
-
-Function.prototype.bind = function() {
- var __method = this, args = $A(arguments), object = args.shift();
- return function() {
- return __method.apply(object, args.concat($A(arguments)));
- }
-}
-
-Function.prototype.bindAsEventListener = function(object) {
- var __method = this;
- return function(event) {
- return __method.call(object, event || window.event);
- }
-}
-
-Object.extend(Number.prototype, {
- toColorPart: function() {
- var digits = this.toString(16);
- if (this < 16) return '0' + digits;
- return digits;
- },
-
- succ: function() {
- return this + 1;
- },
-
- times: function(iterator) {
- $R(0, this, true).each(iterator);
- return this;
- }
-});
-
-var Try = {
- these: function() {
- var returnValue;
-
- for (var i = 0; i < arguments.length; i++) {
- var lambda = arguments[i];
- try {
- returnValue = lambda();
- break;
- } catch (e) {}
- }
-
- return returnValue;
- }
-}
-
-/*--------------------------------------------------------------------------*/
-
-var PeriodicalExecuter = Class.create();
-PeriodicalExecuter.prototype = {
- initialize: function(callback, frequency) {
- this.callback = callback;
- this.frequency = frequency;
- this.currentlyExecuting = false;
-
- this.registerCallback();
- },
-
- registerCallback: function() {
- setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
- },
-
- onTimerEvent: function() {
- if (!this.currentlyExecuting) {
- try {
- this.currentlyExecuting = true;
- this.callback();
- } finally {
- this.currentlyExecuting = false;
- }
- }
- }
-}
-
-/*--------------------------------------------------------------------------*/
-
-function $() {
- var elements = new Array();
-
- for (var i = 0; i < arguments.length; i++) {
- var element = arguments[i];
- if (typeof element == 'string')
- element = document.getElementById(element);
-
- if (arguments.length == 1)
- return element;
-
- elements.push(element);
- }
-
- return elements;
-}
-Object.extend(String.prototype, {
- stripTags: function() {
- return this.replace(/<\/?[^>]+>/gi, '');
- },
-
- stripScripts: function() {
- return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), '');
- },
-
- extractScripts: function() {
- var matchAll = new RegExp(Prototype.ScriptFragment, 'img');
- var matchOne = new RegExp(Prototype.ScriptFragment, 'im');
- return (this.match(matchAll) || []).map(function(scriptTag) {
- return (scriptTag.match(matchOne) || ['', ''])[1];
- });
- },
-
- evalScripts: function() {
- return this.extractScripts().map(eval);
- },
-
- escapeHTML: function() {
- var div = document.createElement('div');
- var text = document.createTextNode(this);
- div.appendChild(text);
- return div.innerHTML;
- },
-
- unescapeHTML: function() {
- var div = document.createElement('div');
- div.innerHTML = this.stripTags();
- return div.childNodes[0] ? div.childNodes[0].nodeValue : '';
- },
-
- toQueryParams: function() {
- var pairs = this.match(/^\??(.*)$/)[1].split('&');
- return pairs.inject({}, function(params, pairString) {
- var pair = pairString.split('=');
- params[pair[0]] = pair[1];
- return params;
- });
- },
-
- toArray: function() {
- return this.split('');
- },
-
- camelize: function() {
- var oStringList = this.split('-');
- if (oStringList.length == 1) return oStringList[0];
-
- var camelizedString = this.indexOf('-') == 0
- ? oStringList[0].charAt(0).toUpperCase() + oStringList[0].substring(1)
- : oStringList[0];
-
- for (var i = 1, len = oStringList.length; i < len; i++) {
- var s = oStringList[i];
- camelizedString += s.charAt(0).toUpperCase() + s.substring(1);
- }
-
- return camelizedString;
- },
-
- inspect: function() {
- return "'" + this.replace('\\', '\\\\').replace("'", '\\\'') + "'";
- }
-});
-
-String.prototype.parseQuery = String.prototype.toQueryParams;
-
-var $break = new Object();
-var $continue = new Object();
-
-var Enumerable = {
- each: function(iterator) {
- var index = 0;
- try {
- this._each(function(value) {
- try {
- iterator(value, index++);
- } catch (e) {
- if (e != $continue) throw e;
- }
- });
- } catch (e) {
- if (e != $break) throw e;
- }
- },
-
- all: function(iterator) {
- var result = true;
- this.each(function(value, index) {
- result = result && !!(iterator || Prototype.K)(value, index);
- if (!result) throw $break;
- });
- return result;
- },
-
- any: function(iterator) {
- var result = true;
- this.each(function(value, index) {
- if (result = !!(iterator || Prototype.K)(value, index))
- throw $break;
- });
- return result;
- },
-
- collect: function(iterator) {
- var results = [];
- this.each(function(value, index) {
- results.push(iterator(value, index));
- });
- return results;
- },
-
- detect: function (iterator) {
- var result;
- this.each(function(value, index) {
- if (iterator(value, index)) {
- result = value;
- throw $break;
- }
- });
- return result;
- },
-
- findAll: function(iterator) {
- var results = [];
- this.each(function(value, index) {
- if (iterator(value, index))
- results.push(value);
- });
- return results;
- },
-
- grep: function(pattern, iterator) {
- var results = [];
- this.each(function(value, index) {
- var stringValue = value.toString();
- if (stringValue.match(pattern))
- results.push((iterator || Prototype.K)(value, index));
- })
- return results;
- },
-
- include: function(object) {
- var found = false;
- this.each(function(value) {
- if (value == object) {
- found = true;
- throw $break;
- }
- });
- return found;
- },
-
- inject: function(memo, iterator) {
- this.each(function(value, index) {
- memo = iterator(memo, value, index);
- });
- return memo;
- },
-
- invoke: function(method) {
- var args = $A(arguments).slice(1);
- return this.collect(function(value) {
- return value[method].apply(value, args);
- });
- },
-
- max: function(iterator) {
- var result;
- this.each(function(value, index) {
- value = (iterator || Prototype.K)(value, index);
- if (value >= (result || value))
- result = value;
- });
- return result;
- },
-
- min: function(iterator) {
- var result;
- this.each(function(value, index) {
- value = (iterator || Prototype.K)(value, index);
- if (value <= (result || value))
- result = value;
- });
- return result;
- },
-
- partition: function(iterator) {
- var trues = [], falses = [];
- this.each(function(value, index) {
- ((iterator || Prototype.K)(value, index) ?
- trues : falses).push(value);
- });
- return [trues, falses];
- },
-
- pluck: function(property) {
- var results = [];
- this.each(function(value, index) {
- results.push(value[property]);
- });
- return results;
- },
-
- reject: function(iterator) {
- var results = [];
- this.each(function(value, index) {
- if (!iterator(value, index))
- results.push(value);
- });
- return results;
- },
-
- sortBy: function(iterator) {
- return this.collect(function(value, index) {
- return {value: value, criteria: iterator(value, index)};
- }).sort(function(left, right) {
- var a = left.criteria, b = right.criteria;
- return a < b ? -1 : a > b ? 1 : 0;
- }).pluck('value');
- },
-
- toArray: function() {
- return this.collect(Prototype.K);
- },
-
- zip: function() {
- var iterator = Prototype.K, args = $A(arguments);
- if (typeof args.last() == 'function')
- iterator = args.pop();
-
- var collections = [this].concat(args).map($A);
- return this.map(function(value, index) {
- iterator(value = collections.pluck(index));
- return value;
- });
- },
-
- inspect: function() {
- return '#';
- }
-}
-
-Object.extend(Enumerable, {
- map: Enumerable.collect,
- find: Enumerable.detect,
- select: Enumerable.findAll,
- member: Enumerable.include,
- entries: Enumerable.toArray
-});
-var $A = Array.from = function(iterable) {
- if (!iterable) return [];
- if (iterable.toArray) {
- return iterable.toArray();
- } else {
- var results = [];
- for (var i = 0; i < iterable.length; i++)
- results.push(iterable[i]);
- return results;
- }
-}
-
-Object.extend(Array.prototype, Enumerable);
-
-Array.prototype._reverse = Array.prototype.reverse;
-
-Object.extend(Array.prototype, {
- _each: function(iterator) {
- for (var i = 0; i < this.length; i++)
- iterator(this[i]);
- },
-
- clear: function() {
- this.length = 0;
- return this;
- },
-
- first: function() {
- return this[0];
- },
-
- last: function() {
- return this[this.length - 1];
- },
-
- compact: function() {
- return this.select(function(value) {
- return value != undefined || value != null;
- });
- },
-
- flatten: function() {
- return this.inject([], function(array, value) {
- return array.concat(value.constructor == Array ?
- value.flatten() : [value]);
- });
- },
-
- without: function() {
- var values = $A(arguments);
- return this.select(function(value) {
- return !values.include(value);
- });
- },
-
- indexOf: function(object) {
- for (var i = 0; i < this.length; i++)
- if (this[i] == object) return i;
- return -1;
- },
-
- reverse: function(inline) {
- return (inline !== false ? this : this.toArray())._reverse();
- },
-
- shift: function() {
- var result = this[0];
- for (var i = 0; i < this.length - 1; i++)
- this[i] = this[i + 1];
- this.length--;
- return result;
- },
-
- inspect: function() {
- return '[' + this.map(Object.inspect).join(', ') + ']';
- }
-});
-var Hash = {
- _each: function(iterator) {
- for (key in this) {
- var value = this[key];
- if (typeof value == 'function') continue;
-
- var pair = [key, value];
- pair.key = key;
- pair.value = value;
- iterator(pair);
- }
- },
-
- keys: function() {
- return this.pluck('key');
- },
-
- values: function() {
- return this.pluck('value');
- },
-
- merge: function(hash) {
- return $H(hash).inject($H(this), function(mergedHash, pair) {
- mergedHash[pair.key] = pair.value;
- return mergedHash;
- });
- },
-
- toQueryString: function() {
- return this.map(function(pair) {
- return pair.map(encodeURIComponent).join('=');
- }).join('&');
- },
-
- inspect: function() {
- return '#';
- }
-}
-
-function $H(object) {
- var hash = Object.extend({}, object || {});
- Object.extend(hash, Enumerable);
- Object.extend(hash, Hash);
- return hash;
-}
-ObjectRange = Class.create();
-Object.extend(ObjectRange.prototype, Enumerable);
-Object.extend(ObjectRange.prototype, {
- initialize: function(start, end, exclusive) {
- this.start = start;
- this.end = end;
- this.exclusive = exclusive;
- },
-
- _each: function(iterator) {
- var value = this.start;
- do {
- iterator(value);
- value = value.succ();
- } while (this.include(value));
- },
-
- include: function(value) {
- if (value < this.start)
- return false;
- if (this.exclusive)
- return value < this.end;
- return value <= this.end;
- }
-});
-
-var $R = function(start, end, exclusive) {
- return new ObjectRange(start, end, exclusive);
-}
-
-var Ajax = {
- getTransport: function() {
- return Try.these(
- function() {return new ActiveXObject('Msxml2.XMLHTTP')},
- function() {return new ActiveXObject('Microsoft.XMLHTTP')},
- function() {return new XMLHttpRequest()}
- ) || false;
- },
-
- activeRequestCount: 0
-}
-
-Ajax.Responders = {
- responders: [],
-
- _each: function(iterator) {
- this.responders._each(iterator);
- },
-
- register: function(responderToAdd) {
- if (!this.include(responderToAdd))
- this.responders.push(responderToAdd);
- },
-
- unregister: function(responderToRemove) {
- this.responders = this.responders.without(responderToRemove);
- },
-
- dispatch: function(callback, request, transport, json) {
- this.each(function(responder) {
- if (responder[callback] && typeof responder[callback] == 'function') {
- try {
- responder[callback].apply(responder, [request, transport, json]);
- } catch (e) {}
- }
- });
- }
-};
-
-Object.extend(Ajax.Responders, Enumerable);
-
-Ajax.Responders.register({
- onCreate: function() {
- Ajax.activeRequestCount++;
- },
-
- onComplete: function() {
- Ajax.activeRequestCount--;
- }
-});
-
-Ajax.Base = function() {};
-Ajax.Base.prototype = {
- setOptions: function(options) {
- this.options = {
- method: 'post',
- asynchronous: true,
- parameters: ''
- }
- Object.extend(this.options, options || {});
- },
-
- responseIsSuccess: function() {
- return this.transport.status == undefined
- || this.transport.status == 0
- || (this.transport.status >= 200 && this.transport.status < 300);
- },
-
- responseIsFailure: function() {
- return !this.responseIsSuccess();
- }
-}
-
-Ajax.Request = Class.create();
-Ajax.Request.Events =
- ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];
-
-Ajax.Request.prototype = Object.extend(new Ajax.Base(), {
- initialize: function(url, options) {
- this.transport = Ajax.getTransport();
- this.setOptions(options);
- this.request(url);
- },
-
- request: function(url) {
- var parameters = this.options.parameters || '';
- if (parameters.length > 0) parameters += '&_=';
-
- try {
- this.url = url;
- if (this.options.method == 'get' && parameters.length > 0)
- this.url += (this.url.match(/\?/) ? '&' : '?') + parameters;
-
- Ajax.Responders.dispatch('onCreate', this, this.transport);
-
- this.transport.open(this.options.method, this.url,
- this.options.asynchronous);
-
- if (this.options.asynchronous) {
- this.transport.onreadystatechange = this.onStateChange.bind(this);
- setTimeout((function() {this.respondToReadyState(1)}).bind(this), 10);
- }
-
- this.setRequestHeaders();
-
- var body = this.options.postBody ? this.options.postBody : parameters;
- this.transport.send(this.options.method == 'post' ? body : null);
-
- } catch (e) {
- this.dispatchException(e);
- }
- },
-
- setRequestHeaders: function() {
- var requestHeaders =
- ['X-Requested-With', 'XMLHttpRequest',
- 'X-Prototype-Version', Prototype.Version];
-
- if (this.options.method == 'post') {
- requestHeaders.push('Content-type',
- 'application/x-www-form-urlencoded');
-
- /* Force "Connection: close" for Mozilla browsers to work around
- * a bug where XMLHttpReqeuest sends an incorrect Content-length
- * header. See Mozilla Bugzilla #246651.
- */
- if (this.transport.overrideMimeType)
- requestHeaders.push('Connection', 'close');
- }
-
- if (this.options.requestHeaders)
- requestHeaders.push.apply(requestHeaders, this.options.requestHeaders);
-
- for (var i = 0; i < requestHeaders.length; i += 2)
- this.transport.setRequestHeader(requestHeaders[i], requestHeaders[i+1]);
- },
-
- onStateChange: function() {
- var readyState = this.transport.readyState;
- if (readyState != 1)
- this.respondToReadyState(this.transport.readyState);
- },
-
- header: function(name) {
- try {
- return this.transport.getResponseHeader(name);
- } catch (e) {}
- },
-
- evalJSON: function() {
- try {
- return eval(this.header('X-JSON'));
- } catch (e) {}
- },
-
- evalResponse: function() {
- try {
- return eval(this.transport.responseText);
- } catch (e) {
- this.dispatchException(e);
- }
- },
-
- respondToReadyState: function(readyState) {
- var event = Ajax.Request.Events[readyState];
- var transport = this.transport, json = this.evalJSON();
-
- if (event == 'Complete') {
- try {
- (this.options['on' + this.transport.status]
- || this.options['on' + (this.responseIsSuccess() ? 'Success' : 'Failure')]
- || Prototype.emptyFunction)(transport, json);
- } catch (e) {
- this.dispatchException(e);
- }
-
- if ((this.header('Content-type') || '').match(/^text\/javascript/i))
- this.evalResponse();
- }
-
- try {
- (this.options['on' + event] || Prototype.emptyFunction)(transport, json);
- Ajax.Responders.dispatch('on' + event, this, transport, json);
- } catch (e) {
- this.dispatchException(e);
- }
-
- /* Avoid memory leak in MSIE: clean up the oncomplete event handler */
- if (event == 'Complete')
- this.transport.onreadystatechange = Prototype.emptyFunction;
- },
-
- dispatchException: function(exception) {
- (this.options.onException || Prototype.emptyFunction)(this, exception);
- Ajax.Responders.dispatch('onException', this, exception);
- }
-});
-
-Ajax.Updater = Class.create();
-
-Object.extend(Object.extend(Ajax.Updater.prototype, Ajax.Request.prototype), {
- initialize: function(container, url, options) {
- this.containers = {
- success: container.success ? $(container.success) : $(container),
- failure: container.failure ? $(container.failure) :
- (container.success ? null : $(container))
- }
-
- this.transport = Ajax.getTransport();
- this.setOptions(options);
-
- var onComplete = this.options.onComplete || Prototype.emptyFunction;
- this.options.onComplete = (function(transport, object) {
- this.updateContent();
- onComplete(transport, object);
- }).bind(this);
-
- this.request(url);
- },
-
- updateContent: function() {
- var receiver = this.responseIsSuccess() ?
- this.containers.success : this.containers.failure;
- var response = this.transport.responseText;
-
- if (!this.options.evalScripts)
- response = response.stripScripts();
-
- if (receiver) {
- if (this.options.insertion) {
- new this.options.insertion(receiver, response);
- } else {
- Element.update(receiver, response);
- }
- }
-
- if (this.responseIsSuccess()) {
- if (this.onComplete)
- setTimeout(this.onComplete.bind(this), 10);
- }
- }
-});
-
-Ajax.PeriodicalUpdater = Class.create();
-Ajax.PeriodicalUpdater.prototype = Object.extend(new Ajax.Base(), {
- initialize: function(container, url, options) {
- this.setOptions(options);
- this.onComplete = this.options.onComplete;
-
- this.frequency = (this.options.frequency || 2);
- this.decay = (this.options.decay || 1);
-
- this.updater = {};
- this.container = container;
- this.url = url;
-
- this.start();
- },
-
- start: function() {
- this.options.onComplete = this.updateComplete.bind(this);
- this.onTimerEvent();
- },
-
- stop: function() {
- this.updater.onComplete = undefined;
- clearTimeout(this.timer);
- (this.onComplete || Prototype.emptyFunction).apply(this, arguments);
- },
-
- updateComplete: function(request) {
- if (this.options.decay) {
- this.decay = (request.responseText == this.lastText ?
- this.decay * this.options.decay : 1);
-
- this.lastText = request.responseText;
- }
- this.timer = setTimeout(this.onTimerEvent.bind(this),
- this.decay * this.frequency * 1000);
- },
-
- onTimerEvent: function() {
- this.updater = new Ajax.Updater(this.container, this.url, this.options);
- }
-});
-document.getElementsByClassName = function(className, parentElement) {
- var children = ($(parentElement) || document.body).getElementsByTagName('*');
- return $A(children).inject([], function(elements, child) {
- if (child.className.match(new RegExp("(^|\\s)" + className + "(\\s|$)")))
- elements.push(child);
- return elements;
- });
-}
-
-/*--------------------------------------------------------------------------*/
-
-if (!window.Element) {
- var Element = new Object();
-}
-
-Object.extend(Element, {
- visible: function(element) {
- return $(element).style.display != 'none';
- },
-
- toggle: function() {
- for (var i = 0; i < arguments.length; i++) {
- var element = $(arguments[i]);
- Element[Element.visible(element) ? 'hide' : 'show'](element);
- }
- },
-
- hide: function() {
- for (var i = 0; i < arguments.length; i++) {
- var element = $(arguments[i]);
- element.style.display = 'none';
- }
- },
-
- show: function() {
- for (var i = 0; i < arguments.length; i++) {
- var element = $(arguments[i]);
- element.style.display = '';
- }
- },
-
- remove: function(element) {
- element = $(element);
- element.parentNode.removeChild(element);
- },
-
- update: function(element, html) {
- $(element).innerHTML = html.stripScripts();
- setTimeout(function() {html.evalScripts()}, 10);
- },
-
- getHeight: function(element) {
- element = $(element);
- return element.offsetHeight;
- },
-
- classNames: function(element) {
- return new Element.ClassNames(element);
- },
-
- hasClassName: function(element, className) {
- if (!(element = $(element))) return;
- return Element.classNames(element).include(className);
- },
-
- addClassName: function(element, className) {
- if (!(element = $(element))) return;
- return Element.classNames(element).add(className);
- },
-
- removeClassName: function(element, className) {
- if (!(element = $(element))) return;
- return Element.classNames(element).remove(className);
- },
-
- // removes whitespace-only text node children
- cleanWhitespace: function(element) {
- element = $(element);
- for (var i = 0; i < element.childNodes.length; i++) {
- var node = element.childNodes[i];
- if (node.nodeType == 3 && !/\S/.test(node.nodeValue))
- Element.remove(node);
- }
- },
-
- empty: function(element) {
- return $(element).innerHTML.match(/^\s*$/);
- },
-
- scrollTo: function(element) {
- element = $(element);
- var x = element.x ? element.x : element.offsetLeft,
- y = element.y ? element.y : element.offsetTop;
- window.scrollTo(x, y);
- },
-
- getStyle: function(element, style) {
- element = $(element);
- var value = element.style[style.camelize()];
- if (!value) {
- if (document.defaultView && document.defaultView.getComputedStyle) {
- var css = document.defaultView.getComputedStyle(element, null);
- value = css ? css.getPropertyValue(style) : null;
- } else if (element.currentStyle) {
- value = element.currentStyle[style.camelize()];
- }
- }
-
- if (window.opera && ['left', 'top', 'right', 'bottom'].include(style))
- if (Element.getStyle(element, 'position') == 'static') value = 'auto';
-
- return value == 'auto' ? null : value;
- },
-
- setStyle: function(element, style) {
- element = $(element);
- for (name in style)
- element.style[name.camelize()] = style[name];
- },
-
- getDimensions: function(element) {
- element = $(element);
- if (Element.getStyle(element, 'display') != 'none')
- return {width: element.offsetWidth, height: element.offsetHeight};
-
- // All *Width and *Height properties give 0 on elements with display none,
- // so enable the element temporarily
- var els = element.style;
- var originalVisibility = els.visibility;
- var originalPosition = els.position;
- els.visibility = 'hidden';
- els.position = 'absolute';
- els.display = '';
- var originalWidth = element.clientWidth;
- var originalHeight = element.clientHeight;
- els.display = 'none';
- els.position = originalPosition;
- els.visibility = originalVisibility;
- return {width: originalWidth, height: originalHeight};
- },
-
- makePositioned: function(element) {
- element = $(element);
- var pos = Element.getStyle(element, 'position');
- if (pos == 'static' || !pos) {
- element._madePositioned = true;
- element.style.position = 'relative';
- // Opera returns the offset relative to the positioning context, when an
- // element is position relative but top and left have not been defined
- if (window.opera) {
- element.style.top = 0;
- element.style.left = 0;
- }
- }
- },
-
- undoPositioned: function(element) {
- element = $(element);
- if (element._madePositioned) {
- element._madePositioned = undefined;
- element.style.position =
- element.style.top =
- element.style.left =
- element.style.bottom =
- element.style.right = '';
- }
- },
-
- makeClipping: function(element) {
- element = $(element);
- if (element._overflow) return;
- element._overflow = element.style.overflow;
- if ((Element.getStyle(element, 'overflow') || 'visible') != 'hidden')
- element.style.overflow = 'hidden';
- },
-
- undoClipping: function(element) {
- element = $(element);
- if (element._overflow) return;
- element.style.overflow = element._overflow;
- element._overflow = undefined;
- }
-});
-
-var Toggle = new Object();
-Toggle.display = Element.toggle;
-
-/*--------------------------------------------------------------------------*/
-
-Abstract.Insertion = function(adjacency) {
- this.adjacency = adjacency;
-}
-
-Abstract.Insertion.prototype = {
- initialize: function(element, content) {
- this.element = $(element);
- this.content = content.stripScripts();
-
- if (this.adjacency && this.element.insertAdjacentHTML) {
- try {
- this.element.insertAdjacentHTML(this.adjacency, this.content);
- } catch (e) {
- if (this.element.tagName.toLowerCase() == 'tbody') {
- this.insertContent(this.contentFromAnonymousTable());
- } else {
- throw e;
- }
- }
- } else {
- this.range = this.element.ownerDocument.createRange();
- if (this.initializeRange) this.initializeRange();
- this.insertContent([this.range.createContextualFragment(this.content)]);
- }
-
- setTimeout(function() {content.evalScripts()}, 10);
- },
-
- contentFromAnonymousTable: function() {
- var div = document.createElement('div');
- div.innerHTML = '';
- return $A(div.childNodes[0].childNodes[0].childNodes);
- }
-}
-
-var Insertion = new Object();
-
-Insertion.Before = Class.create();
-Insertion.Before.prototype = Object.extend(new Abstract.Insertion('beforeBegin'), {
- initializeRange: function() {
- this.range.setStartBefore(this.element);
- },
-
- insertContent: function(fragments) {
- fragments.each((function(fragment) {
- this.element.parentNode.insertBefore(fragment, this.element);
- }).bind(this));
- }
-});
-
-Insertion.Top = Class.create();
-Insertion.Top.prototype = Object.extend(new Abstract.Insertion('afterBegin'), {
- initializeRange: function() {
- this.range.selectNodeContents(this.element);
- this.range.collapse(true);
- },
-
- insertContent: function(fragments) {
- fragments.reverse(false).each((function(fragment) {
- this.element.insertBefore(fragment, this.element.firstChild);
- }).bind(this));
- }
-});
-
-Insertion.Bottom = Class.create();
-Insertion.Bottom.prototype = Object.extend(new Abstract.Insertion('beforeEnd'), {
- initializeRange: function() {
- this.range.selectNodeContents(this.element);
- this.range.collapse(this.element);
- },
-
- insertContent: function(fragments) {
- fragments.each((function(fragment) {
- this.element.appendChild(fragment);
- }).bind(this));
- }
-});
-
-Insertion.After = Class.create();
-Insertion.After.prototype = Object.extend(new Abstract.Insertion('afterEnd'), {
- initializeRange: function() {
- this.range.setStartAfter(this.element);
- },
-
- insertContent: function(fragments) {
- fragments.each((function(fragment) {
- this.element.parentNode.insertBefore(fragment,
- this.element.nextSibling);
- }).bind(this));
- }
-});
-
-/*--------------------------------------------------------------------------*/
-
-Element.ClassNames = Class.create();
-Element.ClassNames.prototype = {
- initialize: function(element) {
- this.element = $(element);
- },
-
- _each: function(iterator) {
- this.element.className.split(/\s+/).select(function(name) {
- return name.length > 0;
- })._each(iterator);
- },
-
- set: function(className) {
- this.element.className = className;
- },
-
- add: function(classNameToAdd) {
- if (this.include(classNameToAdd)) return;
- this.set(this.toArray().concat(classNameToAdd).join(' '));
- },
-
- remove: function(classNameToRemove) {
- if (!this.include(classNameToRemove)) return;
- this.set(this.select(function(className) {
- return className != classNameToRemove;
- }).join(' '));
- },
-
- toString: function() {
- return this.toArray().join(' ');
- }
-}
-
-Object.extend(Element.ClassNames.prototype, Enumerable);
-var Field = {
- clear: function() {
- for (var i = 0; i < arguments.length; i++)
- $(arguments[i]).value = '';
- },
-
- focus: function(element) {
- $(element).focus();
- },
-
- present: function() {
- for (var i = 0; i < arguments.length; i++)
- if ($(arguments[i]).value == '') return false;
- return true;
- },
-
- select: function(element) {
- $(element).select();
- },
-
- activate: function(element) {
- element = $(element);
- element.focus();
- if (element.select)
- element.select();
- }
-}
-
-/*--------------------------------------------------------------------------*/
-
-var Form = {
- serialize: function(form) {
- var elements = Form.getElements($(form));
- var queryComponents = new Array();
-
- for (var i = 0; i < elements.length; i++) {
- var queryComponent = Form.Element.serialize(elements[i]);
- if (queryComponent)
- queryComponents.push(queryComponent);
- }
-
- return queryComponents.join('&');
- },
-
- getElements: function(form) {
- form = $(form);
- var elements = new Array();
-
- for (tagName in Form.Element.Serializers) {
- var tagElements = form.getElementsByTagName(tagName);
- for (var j = 0; j < tagElements.length; j++)
- elements.push(tagElements[j]);
- }
- return elements;
- },
-
- getInputs: function(form, typeName, name) {
- form = $(form);
- var inputs = form.getElementsByTagName('input');
-
- if (!typeName && !name)
- return inputs;
-
- var matchingInputs = new Array();
- for (var i = 0; i < inputs.length; i++) {
- var input = inputs[i];
- if ((typeName && input.type != typeName) ||
- (name && input.name != name))
- continue;
- matchingInputs.push(input);
- }
-
- return matchingInputs;
- },
-
- disable: function(form) {
- var elements = Form.getElements(form);
- for (var i = 0; i < elements.length; i++) {
- var element = elements[i];
- element.blur();
- element.disabled = 'true';
- }
- },
-
- enable: function(form) {
- var elements = Form.getElements(form);
- for (var i = 0; i < elements.length; i++) {
- var element = elements[i];
- element.disabled = '';
- }
- },
-
- findFirstElement: function(form) {
- return Form.getElements(form).find(function(element) {
- return element.type != 'hidden' && !element.disabled &&
- ['input', 'select', 'textarea'].include(element.tagName.toLowerCase());
- });
- },
-
- focusFirstElement: function(form) {
- Field.activate(Form.findFirstElement(form));
- },
-
- reset: function(form) {
- $(form).reset();
- }
-}
-
-Form.Element = {
- serialize: function(element) {
- element = $(element);
- var method = element.tagName.toLowerCase();
- var parameter = Form.Element.Serializers[method](element);
-
- if (parameter) {
- var key = encodeURIComponent(parameter[0]);
- if (key.length == 0) return;
-
- if (parameter[1].constructor != Array)
- parameter[1] = [parameter[1]];
-
- return parameter[1].map(function(value) {
- return key + '=' + encodeURIComponent(value);
- }).join('&');
- }
- },
-
- getValue: function(element) {
- element = $(element);
- var method = element.tagName.toLowerCase();
- var parameter = Form.Element.Serializers[method](element);
-
- if (parameter)
- return parameter[1];
- }
-}
-
-Form.Element.Serializers = {
- input: function(element) {
- switch (element.type.toLowerCase()) {
- case 'submit':
- case 'hidden':
- case 'password':
- case 'text':
- return Form.Element.Serializers.textarea(element);
- case 'checkbox':
- case 'radio':
- return Form.Element.Serializers.inputSelector(element);
- }
- return false;
- },
-
- inputSelector: function(element) {
- if (element.checked)
- return [element.name, element.value];
- },
-
- textarea: function(element) {
- return [element.name, element.value];
- },
-
- select: function(element) {
- return Form.Element.Serializers[element.type == 'select-one' ?
- 'selectOne' : 'selectMany'](element);
- },
-
- selectOne: function(element) {
- var value = '', opt, index = element.selectedIndex;
- if (index >= 0) {
- opt = element.options[index];
- value = opt.value;
- if (!value && !('value' in opt))
- value = opt.text;
- }
- return [element.name, value];
- },
-
- selectMany: function(element) {
- var value = new Array();
- for (var i = 0; i < element.length; i++) {
- var opt = element.options[i];
- if (opt.selected) {
- var optValue = opt.value;
- if (!optValue && !('value' in opt))
- optValue = opt.text;
- value.push(optValue);
- }
- }
- return [element.name, value];
- }
-}
-
-/*--------------------------------------------------------------------------*/
-
-var $F = Form.Element.getValue;
-
-/*--------------------------------------------------------------------------*/
-
-Abstract.TimedObserver = function() {}
-Abstract.TimedObserver.prototype = {
- initialize: function(element, frequency, callback) {
- this.frequency = frequency;
- this.element = $(element);
- this.callback = callback;
-
- this.lastValue = this.getValue();
- this.registerCallback();
- },
-
- registerCallback: function() {
- setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
- },
-
- onTimerEvent: function() {
- var value = this.getValue();
- if (this.lastValue != value) {
- this.callback(this.element, value);
- this.lastValue = value;
- }
- }
-}
-
-Form.Element.Observer = Class.create();
-Form.Element.Observer.prototype = Object.extend(new Abstract.TimedObserver(), {
- getValue: function() {
- return Form.Element.getValue(this.element);
- }
-});
-
-Form.Observer = Class.create();
-Form.Observer.prototype = Object.extend(new Abstract.TimedObserver(), {
- getValue: function() {
- return Form.serialize(this.element);
- }
-});
-
-/*--------------------------------------------------------------------------*/
-
-Abstract.EventObserver = function() {}
-Abstract.EventObserver.prototype = {
- initialize: function(element, callback) {
- this.element = $(element);
- this.callback = callback;
-
- this.lastValue = this.getValue();
- if (this.element.tagName.toLowerCase() == 'form')
- this.registerFormCallbacks();
- else
- this.registerCallback(this.element);
- },
-
- onElementEvent: function() {
- var value = this.getValue();
- if (this.lastValue != value) {
- this.callback(this.element, value);
- this.lastValue = value;
- }
- },
-
- registerFormCallbacks: function() {
- var elements = Form.getElements(this.element);
- for (var i = 0; i < elements.length; i++)
- this.registerCallback(elements[i]);
- },
-
- registerCallback: function(element) {
- if (element.type) {
- switch (element.type.toLowerCase()) {
- case 'checkbox':
- case 'radio':
- Event.observe(element, 'click', this.onElementEvent.bind(this));
- break;
- case 'password':
- case 'text':
- case 'textarea':
- case 'select-one':
- case 'select-multiple':
- Event.observe(element, 'change', this.onElementEvent.bind(this));
- break;
- }
- }
- }
-}
-
-Form.Element.EventObserver = Class.create();
-Form.Element.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), {
- getValue: function() {
- return Form.Element.getValue(this.element);
- }
-});
-
-Form.EventObserver = Class.create();
-Form.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), {
- getValue: function() {
- return Form.serialize(this.element);
- }
-});
-if (!window.Event) {
- var Event = new Object();
-}
-
-Object.extend(Event, {
- KEY_BACKSPACE: 8,
- KEY_TAB: 9,
- KEY_RETURN: 13,
- KEY_ESC: 27,
- KEY_LEFT: 37,
- KEY_UP: 38,
- KEY_RIGHT: 39,
- KEY_DOWN: 40,
- KEY_DELETE: 46,
-
- element: function(event) {
- return event.target || event.srcElement;
- },
-
- isLeftClick: function(event) {
- return (((event.which) && (event.which == 1)) ||
- ((event.button) && (event.button == 1)));
- },
-
- pointerX: function(event) {
- return event.pageX || (event.clientX +
- (document.documentElement.scrollLeft || document.body.scrollLeft));
- },
-
- pointerY: function(event) {
- return event.pageY || (event.clientY +
- (document.documentElement.scrollTop || document.body.scrollTop));
- },
-
- stop: function(event) {
- if (event.preventDefault) {
- event.preventDefault();
- event.stopPropagation();
- } else {
- event.returnValue = false;
- event.cancelBubble = true;
- }
- },
-
- // find the first node with the given tagName, starting from the
- // node the event was triggered on; traverses the DOM upwards
- findElement: function(event, tagName) {
- var element = Event.element(event);
- while (element.parentNode && (!element.tagName ||
- (element.tagName.toUpperCase() != tagName.toUpperCase())))
- element = element.parentNode;
- return element;
- },
-
- observers: false,
-
- _observeAndCache: function(element, name, observer, useCapture) {
- if (!this.observers) this.observers = [];
- if (element.addEventListener) {
- this.observers.push([element, name, observer, useCapture]);
- element.addEventListener(name, observer, useCapture);
- } else if (element.attachEvent) {
- this.observers.push([element, name, observer, useCapture]);
- element.attachEvent('on' + name, observer);
- }
- },
-
- unloadCache: function() {
- if (!Event.observers) return;
- for (var i = 0; i < Event.observers.length; i++) {
- Event.stopObserving.apply(this, Event.observers[i]);
- Event.observers[i][0] = null;
- }
- Event.observers = false;
- },
-
- observe: function(element, name, observer, useCapture) {
- var element = $(element);
- useCapture = useCapture || false;
-
- if (name == 'keypress' &&
- (navigator.appVersion.match(/Konqueror|Safari|KHTML/)
- || element.attachEvent))
- name = 'keydown';
-
- this._observeAndCache(element, name, observer, useCapture);
- },
-
- stopObserving: function(element, name, observer, useCapture) {
- var element = $(element);
- useCapture = useCapture || false;
-
- if (name == 'keypress' &&
- (navigator.appVersion.match(/Konqueror|Safari|KHTML/)
- || element.detachEvent))
- name = 'keydown';
-
- if (element.removeEventListener) {
- element.removeEventListener(name, observer, useCapture);
- } else if (element.detachEvent) {
- element.detachEvent('on' + name, observer);
- }
- }
-});
-
-/* prevent memory leaks in IE */
-Event.observe(window, 'unload', Event.unloadCache, false);
-var Position = {
- // set to true if needed, warning: firefox performance problems
- // NOT neeeded for page scrolling, only if draggable contained in
- // scrollable elements
- includeScrollOffsets: false,
-
- // must be called before calling withinIncludingScrolloffset, every time the
- // page is scrolled
- prepare: function() {
- this.deltaX = window.pageXOffset
- || document.documentElement.scrollLeft
- || document.body.scrollLeft
- || 0;
- this.deltaY = window.pageYOffset
- || document.documentElement.scrollTop
- || document.body.scrollTop
- || 0;
- },
-
- realOffset: function(element) {
- var valueT = 0, valueL = 0;
- do {
- valueT += element.scrollTop || 0;
- valueL += element.scrollLeft || 0;
- element = element.parentNode;
- } while (element);
- return [valueL, valueT];
- },
-
- cumulativeOffset: function(element) {
- var valueT = 0, valueL = 0;
- do {
- valueT += element.offsetTop || 0;
- valueL += element.offsetLeft || 0;
- element = element.offsetParent;
- } while (element);
- return [valueL, valueT];
- },
-
- positionedOffset: function(element) {
- var valueT = 0, valueL = 0;
- do {
- valueT += element.offsetTop || 0;
- valueL += element.offsetLeft || 0;
- element = element.offsetParent;
- if (element) {
- p = Element.getStyle(element, 'position');
- if (p == 'relative' || p == 'absolute') break;
- }
- } while (element);
- return [valueL, valueT];
- },
-
- offsetParent: function(element) {
- if (element.offsetParent) return element.offsetParent;
- if (element == document.body) return element;
-
- while ((element = element.parentNode) && element != document.body)
- if (Element.getStyle(element, 'position') != 'static')
- return element;
-
- return document.body;
- },
-
- // caches x/y coordinate pair to use with overlap
- within: function(element, x, y) {
- if (this.includeScrollOffsets)
- return this.withinIncludingScrolloffsets(element, x, y);
- this.xcomp = x;
- this.ycomp = y;
- this.offset = this.cumulativeOffset(element);
-
- return (y >= this.offset[1] &&
- y < this.offset[1] + element.offsetHeight &&
- x >= this.offset[0] &&
- x < this.offset[0] + element.offsetWidth);
- },
-
- withinIncludingScrolloffsets: function(element, x, y) {
- var offsetcache = this.realOffset(element);
-
- this.xcomp = x + offsetcache[0] - this.deltaX;
- this.ycomp = y + offsetcache[1] - this.deltaY;
- this.offset = this.cumulativeOffset(element);
-
- return (this.ycomp >= this.offset[1] &&
- this.ycomp < this.offset[1] + element.offsetHeight &&
- this.xcomp >= this.offset[0] &&
- this.xcomp < this.offset[0] + element.offsetWidth);
- },
-
- // within must be called directly before
- overlap: function(mode, element) {
- if (!mode) return 0;
- if (mode == 'vertical')
- return ((this.offset[1] + element.offsetHeight) - this.ycomp) /
- element.offsetHeight;
- if (mode == 'horizontal')
- return ((this.offset[0] + element.offsetWidth) - this.xcomp) /
- element.offsetWidth;
- },
-
- clone: function(source, target) {
- source = $(source);
- target = $(target);
- target.style.position = 'absolute';
- var offsets = this.cumulativeOffset(source);
- target.style.top = offsets[1] + 'px';
- target.style.left = offsets[0] + 'px';
- target.style.width = source.offsetWidth + 'px';
- target.style.height = source.offsetHeight + 'px';
- },
-
- page: function(forElement) {
- var valueT = 0, valueL = 0;
-
- var element = forElement;
- do {
- valueT += element.offsetTop || 0;
- valueL += element.offsetLeft || 0;
-
- // Safari fix
- if (element.offsetParent==document.body)
- if (Element.getStyle(element,'position')=='absolute') break;
-
- } while (element = element.offsetParent);
-
- element = forElement;
- do {
- valueT -= element.scrollTop || 0;
- valueL -= element.scrollLeft || 0;
- } while (element = element.parentNode);
-
- return [valueL, valueT];
- },
-
- clone: function(source, target) {
- var options = Object.extend({
- setLeft: true,
- setTop: true,
- setWidth: true,
- setHeight: true,
- offsetTop: 0,
- offsetLeft: 0
- }, arguments[2] || {})
-
- // find page position of source
- source = $(source);
- var p = Position.page(source);
-
- // find coordinate system to use
- target = $(target);
- var delta = [0, 0];
- var parent = null;
- // delta [0,0] will do fine with position: fixed elements,
- // position:absolute needs offsetParent deltas
- if (Element.getStyle(target,'position') == 'absolute') {
- parent = Position.offsetParent(target);
- delta = Position.page(parent);
- }
-
- // correct by body offsets (fixes Safari)
- if (parent == document.body) {
- delta[0] -= document.body.offsetLeft;
- delta[1] -= document.body.offsetTop;
- }
-
- // set position
- if(options.setLeft) target.style.left = (p[0] - delta[0] + options.offsetLeft) + 'px';
- if(options.setTop) target.style.top = (p[1] - delta[1] + options.offsetTop) + 'px';
- if(options.setWidth) target.style.width = source.offsetWidth + 'px';
- if(options.setHeight) target.style.height = source.offsetHeight + 'px';
- },
-
- absolutize: function(element) {
- element = $(element);
- if (element.style.position == 'absolute') return;
- Position.prepare();
-
- var offsets = Position.positionedOffset(element);
- var top = offsets[1];
- var left = offsets[0];
- var width = element.clientWidth;
- var height = element.clientHeight;
-
- element._originalLeft = left - parseFloat(element.style.left || 0);
- element._originalTop = top - parseFloat(element.style.top || 0);
- element._originalWidth = element.style.width;
- element._originalHeight = element.style.height;
-
- element.style.position = 'absolute';
- element.style.top = top + 'px';;
- element.style.left = left + 'px';;
- element.style.width = width + 'px';;
- element.style.height = height + 'px';;
- },
-
- relativize: function(element) {
- element = $(element);
- if (element.style.position == 'relative') return;
- Position.prepare();
-
- element.style.position = 'relative';
- var top = parseFloat(element.style.top || 0) - (element._originalTop || 0);
- var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0);
-
- element.style.top = top + 'px';
- element.style.left = left + 'px';
- element.style.height = element._originalHeight;
- element.style.width = element._originalWidth;
- }
-}
-
-// Safari returns margins on body which is incorrect if the child is absolutely
-// positioned. For performance reasons, redefine Position.cumulativeOffset for
-// KHTML/WebKit only.
-if (/Konqueror|Safari|KHTML/.test(navigator.userAgent)) {
- Position.cumulativeOffset = function(element) {
- var valueT = 0, valueL = 0;
- do {
- valueT += element.offsetTop || 0;
- valueL += element.offsetLeft || 0;
- if (element.offsetParent == document.body)
- if (Element.getStyle(element, 'position') == 'absolute') break;
-
- element = element.offsetParent;
- } while (element);
-
- return [valueL, valueT];
- }
-}
\ No newline at end of file
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/public/robots.txt b/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/public/robots.txt
deleted file mode 100644
index 4ab9e89f..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/public/robots.txt
+++ /dev/null
@@ -1 +0,0 @@
-# See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
\ No newline at end of file
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/script/about b/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/script/about
deleted file mode 100644
index 7b07d46a..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/script/about
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../config/boot'
-require 'commands/about'
\ No newline at end of file
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/script/breakpointer b/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/script/breakpointer
deleted file mode 100644
index 64af76ed..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/script/breakpointer
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../config/boot'
-require 'commands/breakpointer'
\ No newline at end of file
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/script/console b/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/script/console
deleted file mode 100644
index 42f28f7d..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/script/console
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../config/boot'
-require 'commands/console'
\ No newline at end of file
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/script/destroy b/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/script/destroy
deleted file mode 100644
index fa0e6fcd..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/script/destroy
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../config/boot'
-require 'commands/destroy'
\ No newline at end of file
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/script/generate b/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/script/generate
deleted file mode 100644
index ef976e09..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/script/generate
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../config/boot'
-require 'commands/generate'
\ No newline at end of file
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/script/performance/benchmarker b/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/script/performance/benchmarker
deleted file mode 100644
index c842d35d..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/script/performance/benchmarker
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../../config/boot'
-require 'commands/performance/benchmarker'
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/script/performance/profiler b/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/script/performance/profiler
deleted file mode 100644
index d855ac8b..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/script/performance/profiler
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../../config/boot'
-require 'commands/performance/profiler'
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/script/plugin b/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/script/plugin
deleted file mode 100644
index 26ca64c0..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/script/plugin
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../config/boot'
-require 'commands/plugin'
\ No newline at end of file
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/script/process/reaper b/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/script/process/reaper
deleted file mode 100644
index c77f0453..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/script/process/reaper
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../../config/boot'
-require 'commands/process/reaper'
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/script/process/spawner b/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/script/process/spawner
deleted file mode 100644
index 7118f398..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/script/process/spawner
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../../config/boot'
-require 'commands/process/spawner'
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/script/process/spinner b/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/script/process/spinner
deleted file mode 100644
index 6816b32e..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/script/process/spinner
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../../config/boot'
-require 'commands/process/spinner'
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/script/runner b/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/script/runner
deleted file mode 100644
index ccc30f9d..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/script/runner
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../config/boot'
-require 'commands/runner'
\ No newline at end of file
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/script/server b/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/script/server
deleted file mode 100644
index dfabcb88..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/script/server
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../config/boot'
-require 'commands/server'
\ No newline at end of file
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/test/functional/login_controller_test.rb b/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/test/functional/login_controller_test.rb
deleted file mode 100644
index a21d4382..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/test/functional/login_controller_test.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-require File.dirname(__FILE__) + '/../test_helper'
-require 'login_controller'
-
-# Re-raise errors caught by the controller.
-class LoginController; def rescue_action(e) raise e end; end
-
-class LoginControllerTest < Test::Unit::TestCase
- def setup
- @controller = LoginController.new
- @request = ActionController::TestRequest.new
- @response = ActionController::TestResponse.new
- end
-
- # Replace this with your real tests.
- def test_truth
- assert true
- end
-end
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/test/functional/server_controller_test.rb b/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/test/functional/server_controller_test.rb
deleted file mode 100644
index 7afd69e6..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/test/functional/server_controller_test.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-require File.dirname(__FILE__) + '/../test_helper'
-require 'server_controller'
-
-# Re-raise errors caught by the controller.
-class ServerController; def rescue_action(e) raise e end; end
-
-class ServerControllerTest < Test::Unit::TestCase
- def setup
- @controller = ServerController.new
- @request = ActionController::TestRequest.new
- @response = ActionController::TestResponse.new
- end
-
- # Replace this with your real tests.
- def test_truth
- assert true
- end
-end
diff --git a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/test/test_helper.rb b/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/test/test_helper.rb
deleted file mode 100644
index a299c7f6..00000000
--- a/vendor/gems/ruby-openid-2.1.2/examples/rails_openid/test/test_helper.rb
+++ /dev/null
@@ -1,28 +0,0 @@
-ENV["RAILS_ENV"] = "test"
-require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
-require 'test_help'
-
-class Test::Unit::TestCase
- # Transactional fixtures accelerate your tests by wrapping each test method
- # in a transaction that's rolled back on completion. This ensures that the
- # test database remains unchanged so your fixtures don't have to be reloaded
- # between every test method. Fewer database queries means faster tests.
- #
- # Read Mike Clark's excellent walkthrough at
- # http://clarkware.com/cgi/blosxom/2005/10/24#Rails10FastTesting
- #
- # Every Active Record database supports transactions except MyISAM tables
- # in MySQL. Turn off transactional fixtures in this case; however, if you
- # don't care one way or the other, switching from MyISAM to InnoDB tables
- # is recommended.
- self.use_transactional_fixtures = true
-
- # Instantiated fixtures are slow, but give you @david where otherwise you
- # would need people(:david). If you don't want to migrate your existing
- # test cases which use the @david style and don't mind the speed hit (each
- # instantiated fixtures translates to a database query per test method),
- # then set this back to true.
- self.use_instantiated_fixtures = false
-
- # Add more helper methods to be used by all tests here...
-end
diff --git a/vendor/gems/ruby-openid-2.1.2/lib/hmac/hmac.rb b/vendor/gems/ruby-openid-2.1.2/lib/hmac/hmac.rb
deleted file mode 100644
index e8bfa42b..00000000
--- a/vendor/gems/ruby-openid-2.1.2/lib/hmac/hmac.rb
+++ /dev/null
@@ -1,112 +0,0 @@
-# Copyright (C) 2001 Daiki Ueno
-# This library is distributed under the terms of the Ruby license.
-
-# This module provides common interface to HMAC engines.
-# HMAC standard is documented in RFC 2104:
-#
-# H. Krawczyk et al., "HMAC: Keyed-Hashing for Message Authentication",
-# RFC 2104, February 1997
-#
-# These APIs are inspired by JCE 1.2's javax.crypto.Mac interface.
-#
-#
-
-module HMAC
- class Base
- def initialize(algorithm, block_size, output_length, key)
- @algorithm = algorithm
- @block_size = block_size
- @output_length = output_length
- @status = STATUS_UNDEFINED
- @key_xor_ipad = ''
- @key_xor_opad = ''
- set_key(key) unless key.nil?
- end
-
- private
- def check_status
- unless @status == STATUS_INITIALIZED
- raise RuntimeError,
- "The underlying hash algorithm has not yet been initialized."
- end
- end
-
- public
- def set_key(key)
- # If key is longer than the block size, apply hash function
- # to key and use the result as a real key.
- key = @algorithm.digest(key) if key.size > @block_size
- key_xor_ipad = "\x36" * @block_size
- key_xor_opad = "\x5C" * @block_size
- for i in 0 .. key.size - 1
- key_xor_ipad[i] ^= key[i]
- key_xor_opad[i] ^= key[i]
- end
- @key_xor_ipad = key_xor_ipad
- @key_xor_opad = key_xor_opad
- @md = @algorithm.new
- @status = STATUS_INITIALIZED
- end
-
- def reset_key
- @key_xor_ipad.gsub!(/./, '?')
- @key_xor_opad.gsub!(/./, '?')
- @key_xor_ipad[0..-1] = ''
- @key_xor_opad[0..-1] = ''
- @status = STATUS_UNDEFINED
- end
-
- def update(text)
- check_status
- # perform inner H
- md = @algorithm.new
- md.update(@key_xor_ipad)
- md.update(text)
- str = md.digest
- # perform outer H
- md = @algorithm.new
- md.update(@key_xor_opad)
- md.update(str)
- @md = md
- end
- alias << update
-
- def digest
- check_status
- @md.digest
- end
-
- def hexdigest
- check_status
- @md.hexdigest
- end
- alias to_s hexdigest
-
- # These two class methods below are safer than using above
- # instance methods combinatorially because an instance will have
- # held a key even if it's no longer in use.
- def Base.digest(key, text)
- begin
- hmac = self.new(key)
- hmac.update(text)
- hmac.digest
- ensure
- hmac.reset_key
- end
- end
-
- def Base.hexdigest(key, text)
- begin
- hmac = self.new(key)
- hmac.update(text)
- hmac.hexdigest
- ensure
- hmac.reset_key
- end
- end
-
- private_class_method :new, :digest, :hexdigest
- end
-
- STATUS_UNDEFINED, STATUS_INITIALIZED = 0, 1
-end
diff --git a/vendor/gems/ruby-openid-2.1.2/lib/hmac/sha1.rb b/vendor/gems/ruby-openid-2.1.2/lib/hmac/sha1.rb
deleted file mode 100644
index d2f0088a..00000000
--- a/vendor/gems/ruby-openid-2.1.2/lib/hmac/sha1.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-require 'hmac/hmac'
-require 'digest/sha1'
-
-module HMAC
- class SHA1 < Base
- def initialize(key = nil)
- super(Digest::SHA1, 64, 20, key)
- end
- public_class_method :new, :digest, :hexdigest
- end
-end
diff --git a/vendor/gems/ruby-openid-2.1.2/lib/hmac/sha2.rb b/vendor/gems/ruby-openid-2.1.2/lib/hmac/sha2.rb
deleted file mode 100644
index 0412ba40..00000000
--- a/vendor/gems/ruby-openid-2.1.2/lib/hmac/sha2.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-require 'hmac/hmac'
-require 'digest/sha2'
-
-module HMAC
- class SHA256 < Base
- def initialize(key = nil)
- super(Digest::SHA256, 64, 32, key)
- end
- public_class_method :new, :digest, :hexdigest
- end
-
- class SHA384 < Base
- def initialize(key = nil)
- super(Digest::SHA384, 128, 48, key)
- end
- public_class_method :new, :digest, :hexdigest
- end
-
- class SHA512 < Base
- def initialize(key = nil)
- super(Digest::SHA512, 128, 64, key)
- end
- public_class_method :new, :digest, :hexdigest
- end
-end
diff --git a/vendor/gems/ruby-openid-2.1.2/lib/openid.rb b/vendor/gems/ruby-openid-2.1.2/lib/openid.rb
deleted file mode 100644
index de6cc6b4..00000000
--- a/vendor/gems/ruby-openid-2.1.2/lib/openid.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# Copyright 2006-2007 JanRain, Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you
-# may not use this file except in compliance with the License. You may
-# obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-# implied. See the License for the specific language governing
-# permissions and limitations under the License.
-
-module OpenID
- VERSION = "2.1.2"
-end
-
-require "openid/consumer"
-require 'openid/server'
diff --git a/vendor/gems/ruby-openid-2.1.2/lib/openid/association.rb b/vendor/gems/ruby-openid-2.1.2/lib/openid/association.rb
deleted file mode 100644
index fd2cd599..00000000
--- a/vendor/gems/ruby-openid-2.1.2/lib/openid/association.rb
+++ /dev/null
@@ -1,249 +0,0 @@
-require "openid/kvform"
-require "openid/util"
-require "openid/cryptutil"
-require "openid/message"
-
-module OpenID
-
- def self.get_secret_size(assoc_type)
- if assoc_type == 'HMAC-SHA1'
- return 20
- elsif assoc_type == 'HMAC-SHA256'
- return 32
- else
- raise ArgumentError("Unsupported association type: #{assoc_type}")
- end
- end
-
- # An Association holds the shared secret between a relying party and
- # an OpenID provider.
- class Association
- attr_reader :handle, :secret, :issued, :lifetime, :assoc_type
-
- FIELD_ORDER =
- [:version, :handle, :secret, :issued, :lifetime, :assoc_type,]
-
- # Load a serialized Association
- def self.deserialize(serialized)
- parsed = Util.kv_to_seq(serialized)
- parsed_fields = parsed.map{|k, v| k.to_sym}
- if parsed_fields != FIELD_ORDER
- raise ProtocolError, 'Unexpected fields in serialized association'\
- " (Expected #{FIELD_ORDER.inspect}, got #{parsed_fields.inspect})"
- end
- version, handle, secret64, issued_s, lifetime_s, assoc_type =
- parsed.map {|field, value| value}
- if version != '2'
- raise ProtocolError, "Attempted to deserialize unsupported version "\
- "(#{parsed[0][1].inspect})"
- end
-
- self.new(handle,
- Util.from_base64(secret64),
- Time.at(issued_s.to_i),
- lifetime_s.to_i,
- assoc_type)
- end
-
- # Create an Association with an issued time of now
- def self.from_expires_in(expires_in, handle, secret, assoc_type)
- issued = Time.now
- self.new(handle, secret, issued, expires_in, assoc_type)
- end
-
- def initialize(handle, secret, issued, lifetime, assoc_type)
- @handle = handle
- @secret = secret
- @issued = issued
- @lifetime = lifetime
- @assoc_type = assoc_type
- end
-
- # Serialize the association to a form that's consistent across
- # JanRain OpenID libraries.
- def serialize
- data = {
- :version => '2',
- :handle => handle,
- :secret => Util.to_base64(secret),
- :issued => issued.to_i.to_s,
- :lifetime => lifetime.to_i.to_s,
- :assoc_type => assoc_type,
- }
-
- Util.assert(data.length == FIELD_ORDER.length)
-
- pairs = FIELD_ORDER.map{|field| [field.to_s, data[field]]}
- return Util.seq_to_kv(pairs, strict=true)
- end
-
- # The number of seconds until this association expires
- def expires_in(now=nil)
- if now.nil?
- now = Time.now.to_i
- else
- now = now.to_i
- end
- time_diff = (issued.to_i + lifetime) - now
- if time_diff < 0
- return 0
- else
- return time_diff
- end
- end
-
- # Generate a signature for a sequence of [key, value] pairs
- def sign(pairs)
- kv = Util.seq_to_kv(pairs)
- case assoc_type
- when 'HMAC-SHA1'
- CryptUtil.hmac_sha1(@secret, kv)
- when 'HMAC-SHA256'
- CryptUtil.hmac_sha256(@secret, kv)
- else
- raise ProtocolError, "Association has unknown type: "\
- "#{assoc_type.inspect}"
- end
- end
-
- # Generate the list of pairs that form the signed elements of the
- # given message
- def make_pairs(message)
- signed = message.get_arg(OPENID_NS, 'signed')
- if signed.nil?
- raise ProtocolError, 'Missing signed list'
- end
- signed_fields = signed.split(',', -1)
- data = message.to_post_args
- signed_fields.map {|field| [field, data.fetch('openid.'+field,'')] }
- end
-
- # Return whether the message's signature passes
- def check_message_signature(message)
- message_sig = message.get_arg(OPENID_NS, 'sig')
- if message_sig.nil?
- raise ProtocolError, "#{message} has no sig."
- end
- calculated_sig = get_message_signature(message)
- return calculated_sig == message_sig
- end
-
- # Get the signature for this message
- def get_message_signature(message)
- Util.to_base64(sign(make_pairs(message)))
- end
-
- def ==(other)
- (other.class == self.class and
- other.handle == self.handle and
- other.secret == self.secret and
-
- # The internals of the time objects seemed to differ
- # in an opaque way when serializing/unserializing.
- # I don't think this will be a problem.
- other.issued.to_i == self.issued.to_i and
-
- other.lifetime == self.lifetime and
- other.assoc_type == self.assoc_type)
- end
-
- # Add a signature (and a signed list) to a message.
- def sign_message(message)
- if (message.has_key?(OPENID_NS, 'sig') or
- message.has_key?(OPENID_NS, 'signed'))
- raise ArgumentError, 'Message already has signed list or signature'
- end
-
- extant_handle = message.get_arg(OPENID_NS, 'assoc_handle')
- if extant_handle and extant_handle != self.handle
- raise ArgumentError, "Message has a different association handle"
- end
-
- signed_message = message.copy()
- signed_message.set_arg(OPENID_NS, 'assoc_handle', self.handle)
- message_keys = signed_message.to_post_args.keys()
-
- signed_list = []
- message_keys.each { |k|
- if k.starts_with?('openid.')
- signed_list << k[7..-1]
- end
- }
-
- signed_list << 'signed'
- signed_list.sort!
-
- signed_message.set_arg(OPENID_NS, 'signed', signed_list.join(','))
- sig = get_message_signature(signed_message)
- signed_message.set_arg(OPENID_NS, 'sig', sig)
- return signed_message
- end
- end
-
- class AssociationNegotiator
- attr_reader :allowed_types
-
- def self.get_session_types(assoc_type)
- case assoc_type
- when 'HMAC-SHA1'
- ['DH-SHA1', 'no-encryption']
- when 'HMAC-SHA256'
- ['DH-SHA256', 'no-encryption']
- else
- raise ProtocolError, "Unknown association type #{assoc_type.inspect}"
- end
- end
-
- def self.check_session_type(assoc_type, session_type)
- if !get_session_types(assoc_type).include?(session_type)
- raise ProtocolError, "Session type #{session_type.inspect} not "\
- "valid for association type #{assoc_type.inspect}"
- end
- end
-
- def initialize(allowed_types)
- self.allowed_types=(allowed_types)
- end
-
- def copy
- Marshal.load(Marshal.dump(self))
- end
-
- def allowed_types=(allowed_types)
- allowed_types.each do |assoc_type, session_type|
- self.class.check_session_type(assoc_type, session_type)
- end
- @allowed_types = allowed_types
- end
-
- def add_allowed_type(assoc_type, session_type=nil)
- if session_type.nil?
- session_types = self.class.get_session_types(assoc_type)
- else
- self.class.check_session_type(assoc_type, session_type)
- session_types = [session_type]
- end
- for session_type in session_types do
- @allowed_types << [assoc_type, session_type]
- end
- end
-
- def allowed?(assoc_type, session_type)
- @allowed_types.include?([assoc_type, session_type])
- end
-
- def get_allowed_type
- @allowed_types.empty? ? nil : @allowed_types[0]
- end
- end
-
- DefaultNegotiator =
- AssociationNegotiator.new([['HMAC-SHA1', 'DH-SHA1'],
- ['HMAC-SHA1', 'no-encryption'],
- ['HMAC-SHA256', 'DH-SHA256'],
- ['HMAC-SHA256', 'no-encryption']])
-
- EncryptedNegotiator =
- AssociationNegotiator.new([['HMAC-SHA1', 'DH-SHA1'],
- ['HMAC-SHA256', 'DH-SHA256']])
-end
diff --git a/vendor/gems/ruby-openid-2.1.2/lib/openid/consumer.rb b/vendor/gems/ruby-openid-2.1.2/lib/openid/consumer.rb
deleted file mode 100644
index f7c52377..00000000
--- a/vendor/gems/ruby-openid-2.1.2/lib/openid/consumer.rb
+++ /dev/null
@@ -1,394 +0,0 @@
-require "openid/consumer/idres.rb"
-require "openid/consumer/checkid_request.rb"
-require "openid/consumer/associationmanager.rb"
-require "openid/consumer/responses.rb"
-require "openid/consumer/discovery_manager"
-require "openid/consumer/discovery"
-require "openid/message"
-require "openid/yadis/discovery"
-require "openid/store/nonce"
-
-module OpenID
- # OpenID support for Relying Parties (aka Consumers).
- #
- # This module documents the main interface with the OpenID consumer
- # library. The only part of the library which has to be used and
- # isn't documented in full here is the store required to create an
- # Consumer instance.
- #
- # = OVERVIEW
- #
- # The OpenID identity verification process most commonly uses the
- # following steps, as visible to the user of this library:
- #
- # 1. The user enters their OpenID into a field on the consumer's
- # site, and hits a login button.
- #
- # 2. The consumer site discovers the user's OpenID provider using
- # the Yadis protocol.
- #
- # 3. The consumer site sends the browser a redirect to the OpenID
- # provider. This is the authentication request as described in
- # the OpenID specification.
- #
- # 4. The OpenID provider's site sends the browser a redirect back to
- # the consumer site. This redirect contains the provider's
- # response to the authentication request.
- #
- # The most important part of the flow to note is the consumer's site
- # must handle two separate HTTP requests in order to perform the
- # full identity check.
- #
- # = LIBRARY DESIGN
- #
- # This consumer library is designed with that flow in mind. The
- # goal is to make it as easy as possible to perform the above steps
- # securely.
- #
- # At a high level, there are two important parts in the consumer
- # library. The first important part is this module, which contains
- # the interface to actually use this library. The second is
- # openid/store/interface.rb, which describes the interface to use if
- # you need to create a custom method for storing the state this
- # library needs to maintain between requests.
- #
- # In general, the second part is less important for users of the
- # library to know about, as several implementations are provided
- # which cover a wide variety of situations in which consumers may
- # use the library.
- #
- # The Consumer class has methods corresponding to the actions
- # necessary in each of steps 2, 3, and 4 described in the overview.
- # Use of this library should be as easy as creating an Consumer
- # instance and calling the methods appropriate for the action the
- # site wants to take.
- #
- # This library automatically detects which version of the OpenID
- # protocol should be used for a transaction and constructs the
- # proper requests and responses. Users of this library do not need
- # to worry about supporting multiple protocol versions; the library
- # supports them implicitly. Depending on the version of the
- # protocol in use, the OpenID transaction may be more secure. See
- # the OpenID specifications for more information.
- #
- # = SESSIONS, STORES, AND STATELESS MODE
- #
- # The Consumer object keeps track of two types of state:
- #
- # 1. State of the user's current authentication attempt. Things
- # like the identity URL, the list of endpoints discovered for
- # that URL, and in case where some endpoints are unreachable, the
- # list of endpoints already tried. This state needs to be held
- # from Consumer.begin() to Consumer.complete(), but it is only
- # applicable to a single session with a single user agent, and at
- # the end of the authentication process (i.e. when an OP replies
- # with either id_res. or cancel it may be
- # discarded.
- #
- # 2. State of relationships with servers, i.e. shared secrets
- # (associations) with servers and nonces seen on signed messages.
- # This information should persist from one session to the next
- # and should not be bound to a particular user-agent.
- #
- # These two types of storage are reflected in the first two
- # arguments of Consumer's constructor, session and
- # store. session is a dict-like object and we
- # hope your web framework provides you with one of these bound to
- # the user agent. store is an instance of Store.
- #
- # Since the store does hold secrets shared between your application
- # and the OpenID provider, you should be careful about how you use
- # it in a shared hosting environment. If the filesystem or database
- # permissions of your web host allow strangers to read from them, do
- # not store your data there! If you have no safe place to store
- # your data, construct your consumer with nil for the store, and it
- # will operate only in stateless mode. Stateless mode may be
- # slower, put more load on the OpenID provider, and trusts the
- # provider to keep you safe from replay attacks.
- #
- # Several store implementation are provided, and the interface is
- # fully documented so that custom stores can be used as well. See
- # the documentation for the Consumer class for more information on
- # the interface for stores. The implementations that are provided
- # allow the consumer site to store the necessary data in several
- # different ways, including several SQL databases and normal files
- # on disk.
- #
- # = IMMEDIATE MODE
- #
- # In the flow described above, the user may need to confirm to the
- # OpenID provider that it's ok to disclose his or her identity. The
- # provider may draw pages asking for information from the user
- # before it redirects the browser back to the consumer's site. This
- # is generally transparent to the consumer site, so it is typically
- # ignored as an implementation detail.
- #
- # There can be times, however, where the consumer site wants to get
- # a response immediately. When this is the case, the consumer can
- # put the library in immediate mode. In immediate mode, there is an
- # extra response possible from the server, which is essentially the
- # server reporting that it doesn't have enough information to answer
- # the question yet.
- #
- # = USING THIS LIBRARY
- #
- # Integrating this library into an application is usually a
- # relatively straightforward process. The process should basically
- # follow this plan:
- #
- # Add an OpenID login field somewhere on your site. When an OpenID
- # is entered in that field and the form is submitted, it should make
- # a request to the your site which includes that OpenID URL.
- #
- # First, the application should instantiate a Consumer with a
- # session for per-user state and store for shared state using the
- # store of choice.
- #
- # Next, the application should call the begin method of
- # Consumer instance. This method takes the OpenID URL as entered by
- # the user. The begin method returns a CheckIDRequest
- # object.
- #
- # Next, the application should call the redirect_url method on the
- # CheckIDRequest object. The parameter return_to is the
- # URL that the OpenID server will send the user back to after
- # attempting to verify his or her identity. The realm
- # parameter is the URL (or URL pattern) that identifies your web
- # site to the user when he or she is authorizing it. Send a
- # redirect to the resulting URL to the user's browser.
- #
- # That's the first half of the authentication process. The second
- # half of the process is done after the user's OpenID Provider sends
- # the user's browser a redirect back to your site to complete their
- # login.
- #
- # When that happens, the user will contact your site at the URL
- # given as the return_to URL to the redirect_url call made
- # above. The request will have several query parameters added to
- # the URL by the OpenID provider as the information necessary to
- # finish the request.
- #
- # Get a Consumer instance with the same session and store as before
- # and call its complete() method, passing in all the received query
- # arguments and URL currently being handled.
- #
- # There are multiple possible return types possible from that
- # method. These indicate the whether or not the login was
- # successful, and include any additional information appropriate for
- # their type.
- class Consumer
- attr_accessor :session_key_prefix
-
- # Initialize a Consumer instance.
- #
- # You should create a new instance of the Consumer object with
- # every HTTP request that handles OpenID transactions.
- #
- # session: the session object to use to store request information.
- # The session should behave like a hash.
- #
- # store: an object that implements the interface in Store.
- def initialize(session, store)
- @session = session
- @store = store
- @session_key_prefix = 'OpenID::Consumer::'
- end
-
- # Start the OpenID authentication process. See steps 1-2 in the
- # overview for the Consumer class.
- #
- # user_url: Identity URL given by the user. This method performs a
- # textual transformation of the URL to try and make sure it is
- # normalized. For example, a user_url of example.com will be
- # normalized to http://example.com/ normalizing and resolving any
- # redirects the server might issue.
- #
- # anonymous: A boolean value. Whether to make an anonymous
- # request of the OpenID provider. Such a request does not ask for
- # an authorization assertion for an OpenID identifier, but may be
- # used with extensions to pass other data. e.g. "I don't care who
- # you are, but I'd like to know your time zone."
- #
- # Returns a CheckIDRequest object containing the discovered
- # information, with a method for building a redirect URL to the
- # server, as described in step 3 of the overview. This object may
- # also be used to add extension arguments to the request, using
- # its add_extension_arg method.
- #
- # Raises DiscoveryFailure when no OpenID server can be found for
- # this URL.
- def begin(openid_identifier, anonymous=false)
- manager = discovery_manager(openid_identifier)
- service = manager.get_next_service(&method(:discover))
-
- if service.nil?
- raise DiscoveryFailure.new("No usable OpenID services were found "\
- "for #{openid_identifier.inspect}", nil)
- else
- begin_without_discovery(service, anonymous)
- end
- end
-
- # Start OpenID verification without doing OpenID server
- # discovery. This method is used internally by Consumer.begin()
- # after discovery is performed, and exists to provide an interface
- # for library users needing to perform their own discovery.
- #
- # service: an OpenID service endpoint descriptor. This object and
- # factories for it are found in the openid/consumer/discovery.rb
- # module.
- #
- # Returns an OpenID authentication request object.
- def begin_without_discovery(service, anonymous)
- assoc = association_manager(service).get_association
- checkid_request = CheckIDRequest.new(assoc, service)
- checkid_request.anonymous = anonymous
-
- if service.compatibility_mode
- rt_args = checkid_request.return_to_args
- rt_args[Consumer.openid1_return_to_nonce_name] = Nonce.mk_nonce
- rt_args[Consumer.openid1_return_to_claimed_id_name] =
- service.claimed_id
- end
-
- self.last_requested_endpoint = service
- return checkid_request
- end
-
- # Called to interpret the server's response to an OpenID
- # request. It is called in step 4 of the flow described in the
- # Consumer overview.
- #
- # query: A hash of the query parameters for this HTTP request.
- # Note that in rails, this is not params but
- # params.reject{|k,v|request.path_parameters[k]}
- # because controller and action and other
- # "path parameters" are included in params.
- #
- # current_url: Extract the URL of the current request from your
- # application's web request framework and specify it here to have it
- # checked against the openid.return_to value in the response. Do not
- # just pass args['openid.return_to'] here; that will defeat the
- # purpose of this check. (See OpenID Authentication 2.0 section 11.1.)
- #
- # If the return_to URL check fails, the status of the completion will be
- # FAILURE.
-
- #
- # Returns a subclass of Response. The type of response is
- # indicated by the status attribute, which will be one of
- # SUCCESS, CANCEL, FAILURE, or SETUP_NEEDED.
- def complete(query, current_url)
- message = Message.from_post_args(query)
- mode = message.get_arg(OPENID_NS, 'mode', 'invalid')
- begin
- meth = method('complete_' + mode)
- rescue NameError
- meth = method(:complete_invalid)
- end
- response = meth.call(message, current_url)
- cleanup_last_requested_endpoint
- if [SUCCESS, CANCEL].member?(response.status)
- cleanup_session
- end
- return response
- end
-
- protected
-
- def session_get(name)
- @session[session_key(name)]
- end
-
- def session_set(name, val)
- @session[session_key(name)] = val
- end
-
- def session_key(suffix)
- @session_key_prefix + suffix
- end
-
- def last_requested_endpoint
- session_get('last_requested_endpoint')
- end
-
- def last_requested_endpoint=(endpoint)
- session_set('last_requested_endpoint', endpoint)
- end
-
- def cleanup_last_requested_endpoint
- @session[session_key('last_requested_endpoint')] = nil
- end
-
- def discovery_manager(openid_identifier)
- DiscoveryManager.new(@session, openid_identifier, @session_key_prefix)
- end
-
- def cleanup_session
- discovery_manager(nil).cleanup(true)
- end
-
-
- def discover(identifier)
- OpenID.discover(identifier)
- end
-
- def negotiator
- DefaultNegotiator
- end
-
- def association_manager(service)
- AssociationManager.new(@store, service.server_url,
- service.compatibility_mode, negotiator)
- end
-
- def handle_idres(message, current_url)
- IdResHandler.new(message, current_url, @store, last_requested_endpoint)
- end
-
- def complete_invalid(message, unused_return_to)
- mode = message.get_arg(OPENID_NS, 'mode', '')
- return FailureResponse.new(last_requested_endpoint,
- "Invalid openid.mode: #{mode}")
- end
-
- def complete_cancel(unused_message, unused_return_to)
- return CancelResponse.new(last_requested_endpoint)
- end
-
- def complete_error(message, unused_return_to)
- error = message.get_arg(OPENID_NS, 'error')
- contact = message.get_arg(OPENID_NS, 'contact')
- reference = message.get_arg(OPENID_NS, 'reference')
-
- return FailureResponse.new(last_requested_endpoint,
- error, contact, reference)
- end
-
- def complete_setup_needed(message, unused_return_to)
- if message.is_openid1
- return complete_invalid(message, nil)
- else
- return SetupNeededResponse.new(last_requested_endpoint, nil)
- end
- end
-
- def complete_id_res(message, current_url)
- if message.is_openid1
- setup_url = message.get_arg(OPENID1_NS, 'user_setup_url')
- if !setup_url.nil?
- return SetupNeededResponse.new(last_requested_endpoint, setup_url)
- end
- end
-
- begin
- idres = handle_idres(message, current_url)
- rescue OpenIDError => why
- return FailureResponse.new(last_requested_endpoint, why.message)
- else
- return SuccessResponse.new(idres.endpoint, message,
- idres.signed_fields)
- end
- end
- end
-end
diff --git a/vendor/gems/ruby-openid-2.1.2/lib/openid/consumer/associationmanager.rb b/vendor/gems/ruby-openid-2.1.2/lib/openid/consumer/associationmanager.rb
deleted file mode 100644
index 51c0f3d2..00000000
--- a/vendor/gems/ruby-openid-2.1.2/lib/openid/consumer/associationmanager.rb
+++ /dev/null
@@ -1,340 +0,0 @@
-require "openid/dh"
-require "openid/util"
-require "openid/kvpost"
-require "openid/cryptutil"
-require "openid/protocolerror"
-require "openid/association"
-
-module OpenID
- class Consumer
-
- # A superclass for implementing Diffie-Hellman association sessions.
- class DiffieHellmanSession
- class << self
- attr_reader :session_type, :secret_size, :allowed_assoc_types,
- :hashfunc
- end
-
- def initialize(dh=nil)
- if dh.nil?
- dh = DiffieHellman.from_defaults
- end
- @dh = dh
- end
-
- # Return the query parameters for requesting an association
- # using this Diffie-Hellman association session
- def get_request
- args = {'dh_consumer_public' => CryptUtil.num_to_base64(@dh.public)}
- if (!@dh.using_default_values?)
- args['dh_modulus'] = CryptUtil.num_to_base64(@dh.modulus)
- args['dh_gen'] = CryptUtil.num_to_base64(@dh.generator)
- end
-
- return args
- end
-
- # Process the response from a successful association request and
- # return the shared secret for this association
- def extract_secret(response)
- dh_server_public64 = response.get_arg(OPENID_NS, 'dh_server_public',
- NO_DEFAULT)
- enc_mac_key64 = response.get_arg(OPENID_NS, 'enc_mac_key', NO_DEFAULT)
- dh_server_public = CryptUtil.base64_to_num(dh_server_public64)
- enc_mac_key = Util.from_base64(enc_mac_key64)
- return @dh.xor_secret(self.class.hashfunc,
- dh_server_public, enc_mac_key)
- end
- end
-
- # A Diffie-Hellman association session that uses SHA1 as its hash
- # function
- class DiffieHellmanSHA1Session < DiffieHellmanSession
- @session_type = 'DH-SHA1'
- @secret_size = 20
- @allowed_assoc_types = ['HMAC-SHA1']
- @hashfunc = CryptUtil.method(:sha1)
- end
-
- # A Diffie-Hellman association session that uses SHA256 as its hash
- # function
- class DiffieHellmanSHA256Session < DiffieHellmanSession
- @session_type = 'DH-SHA256'
- @secret_size = 32
- @allowed_assoc_types = ['HMAC-SHA256']
- @hashfunc = CryptUtil.method(:sha256)
- end
-
- # An association session that does not use encryption
- class NoEncryptionSession
- class << self
- attr_reader :session_type, :allowed_assoc_types
- end
- @session_type = 'no-encryption'
- @allowed_assoc_types = ['HMAC-SHA1', 'HMAC-SHA256']
-
- def get_request
- return {}
- end
-
- def extract_secret(response)
- mac_key64 = response.get_arg(OPENID_NS, 'mac_key', NO_DEFAULT)
- return Util.from_base64(mac_key64)
- end
- end
-
- # An object that manages creating and storing associations for an
- # OpenID provider endpoint
- class AssociationManager
- def self.create_session(session_type)
- case session_type
- when 'no-encryption'
- NoEncryptionSession.new
- when 'DH-SHA1'
- DiffieHellmanSHA1Session.new
- when 'DH-SHA256'
- DiffieHellmanSHA256Session.new
- else
- raise ArgumentError, "Unknown association session type: "\
- "#{session_type.inspect}"
- end
- end
-
- def initialize(store, server_url, compatibility_mode=false,
- negotiator=nil)
- @store = store
- @server_url = server_url
- @compatibility_mode = compatibility_mode
- @negotiator = negotiator || DefaultNegotiator
- end
-
- def get_association
- if @store.nil?
- return nil
- end
-
- assoc = @store.get_association(@server_url)
- if assoc.nil? || assoc.expires_in <= 0
- assoc = negotiate_association
- if !assoc.nil?
- @store.store_association(@server_url, assoc)
- end
- end
-
- return assoc
- end
-
- def negotiate_association
- assoc_type, session_type = @negotiator.get_allowed_type
- begin
- return request_association(assoc_type, session_type)
- rescue ServerError => why
- supported_types = extract_supported_association_type(why, assoc_type)
- if !supported_types.nil?
- # Attempt to create an association from the assoc_type and
- # session_type that the server told us it supported.
- assoc_type, session_type = supported_types
- begin
- return request_association(assoc_type, session_type)
- rescue ServerError => why
- Util.log("Server #{@server_url} refused its suggested " \
- "association type: session_type=#{session_type}, " \
- "assoc_type=#{assoc_type}")
- return nil
- end
- end
- end
- end
-
- protected
- def extract_supported_association_type(server_error, assoc_type)
- # Any error message whose code is not 'unsupported-type' should
- # be considered a total failure.
- if (server_error.error_code != 'unsupported-type' or
- server_error.message.is_openid1)
- Util.log("Server error when requesting an association from "\
- "#{@server_url}: #{server_error.error_text}")
- return nil
- end
-
- # The server didn't like the association/session type that we
- # sent, and it sent us back a message that might tell us how to
- # handle it.
- Util.log("Unsupported association type #{assoc_type}: "\
- "#{server_error.error_text}")
-
- # Extract the session_type and assoc_type from the error message
- assoc_type = server_error.message.get_arg(OPENID_NS, 'assoc_type')
- session_type = server_error.message.get_arg(OPENID_NS, 'session_type')
-
- if assoc_type.nil? or session_type.nil?
- Util.log("Server #{@server_url} responded with unsupported "\
- "association session but did not supply a fallback.")
- return nil
- elsif !@negotiator.allowed?(assoc_type, session_type)
- Util.log("Server sent unsupported session/association type: "\
- "session_type=#{session_type}, assoc_type=#{assoc_type}")
- return nil
- else
- return [assoc_type, session_type]
- end
- end
-
- # Make and process one association request to this endpoint's OP
- # endpoint URL. Returns an association object or nil if the
- # association processing failed. Raises ServerError when the
- # remote OpenID server returns an error.
- def request_association(assoc_type, session_type)
- assoc_session, args = create_associate_request(assoc_type, session_type)
-
- begin
- response = OpenID.make_kv_post(args, @server_url)
- return extract_association(response, assoc_session)
- rescue HTTPStatusError => why
- Util.log("Got HTTP status error when requesting association: #{why}")
- return nil
- rescue Message::KeyNotFound => why
- Util.log("Missing required parameter in response from "\
- "#{@server_url}: #{why}")
- return nil
-
- rescue ProtocolError => why
- Util.log("Protocol error processing response from #{@server_url}: "\
- "#{why}")
- return nil
- end
- end
-
- # Create an association request for the given assoc_type and
- # session_type. Returns a pair of the association session object
- # and the request message that will be sent to the server.
- def create_associate_request(assoc_type, session_type)
- assoc_session = self.class.create_session(session_type)
- args = {
- 'mode' => 'associate',
- 'assoc_type' => assoc_type,
- }
-
- if !@compatibility_mode
- args['ns'] = OPENID2_NS
- end
-
- # Leave out the session type if we're in compatibility mode
- # *and* it's no-encryption.
- if !@compatibility_mode ||
- assoc_session.class.session_type != 'no-encryption'
- args['session_type'] = assoc_session.class.session_type
- end
-
- args.merge!(assoc_session.get_request)
- message = Message.from_openid_args(args)
- return assoc_session, message
- end
-
- # Given an association response message, extract the OpenID 1.X
- # session type. Returns the association type for this message
- #
- # This function mostly takes care of the 'no-encryption' default
- # behavior in OpenID 1.
- #
- # If the association type is plain-text, this function will
- # return 'no-encryption'
- def get_openid1_session_type(assoc_response)
- # If it's an OpenID 1 message, allow session_type to default
- # to nil (which signifies "no-encryption")
- session_type = assoc_response.get_arg(OPENID1_NS, 'session_type')
-
- # Handle the differences between no-encryption association
- # respones in OpenID 1 and 2:
-
- # no-encryption is not really a valid session type for
- # OpenID 1, but we'll accept it anyway, while issuing a
- # warning.
- if session_type == 'no-encryption'
- Util.log("WARNING: #{@server_url} sent 'no-encryption'"\
- "for OpenID 1.X")
-
- # Missing or empty session type is the way to flag a
- # 'no-encryption' response. Change the session type to
- # 'no-encryption' so that it can be handled in the same
- # way as OpenID 2 'no-encryption' respones.
- elsif session_type == '' || session_type.nil?
- session_type = 'no-encryption'
- end
-
- return session_type
- end
-
- def self.extract_expires_in(message)
- # expires_in should be a base-10 string.
- expires_in_str = message.get_arg(OPENID_NS, 'expires_in', NO_DEFAULT)
- if !(/\A\d+\Z/ =~ expires_in_str)
- raise ProtocolError, "Invalid expires_in field: #{expires_in_str}"
- end
- expires_in_str.to_i
- end
-
- # Attempt to extract an association from the response, given the
- # association response message and the established association
- # session.
- def extract_association(assoc_response, assoc_session)
- # Extract the common fields from the response, raising an
- # exception if they are not found
- assoc_type = assoc_response.get_arg(OPENID_NS, 'assoc_type',
- NO_DEFAULT)
- assoc_handle = assoc_response.get_arg(OPENID_NS, 'assoc_handle',
- NO_DEFAULT)
- expires_in = self.class.extract_expires_in(assoc_response)
-
- # OpenID 1 has funny association session behaviour.
- if assoc_response.is_openid1
- session_type = get_openid1_session_type(assoc_response)
- else
- session_type = assoc_response.get_arg(OPENID2_NS, 'session_type',
- NO_DEFAULT)
- end
-
- # Session type mismatch
- if assoc_session.class.session_type != session_type
- if (assoc_response.is_openid1 and session_type == 'no-encryption')
- # In OpenID 1, any association request can result in a
- # 'no-encryption' association response. Setting
- # assoc_session to a new no-encryption session should
- # make the rest of this function work properly for
- # that case.
- assoc_session = NoEncryptionSession.new
- else
- # Any other mismatch, regardless of protocol version
- # results in the failure of the association session
- # altogether.
- raise ProtocolError, "Session type mismatch. Expected "\
- "#{assoc_session.class.session_type}, got "\
- "#{session_type}"
- end
- end
-
- # Make sure assoc_type is valid for session_type
- if !assoc_session.class.allowed_assoc_types.member?(assoc_type)
- raise ProtocolError, "Unsupported assoc_type for session "\
- "#{assoc_session.class.session_type} "\
- "returned: #{assoc_type}"
- end
-
- # Delegate to the association session to extract the secret
- # from the response, however is appropriate for that session
- # type.
- begin
- secret = assoc_session.extract_secret(assoc_response)
- rescue Message::KeyNotFound, ArgumentError => why
- raise ProtocolError, "Malformed response for "\
- "#{assoc_session.class.session_type} "\
- "session: #{why.message}"
- end
-
-
- return Association.from_expires_in(expires_in, assoc_handle, secret,
- assoc_type)
- end
- end
- end
-end
diff --git a/vendor/gems/ruby-openid-2.1.2/lib/openid/consumer/checkid_request.rb b/vendor/gems/ruby-openid-2.1.2/lib/openid/consumer/checkid_request.rb
deleted file mode 100644
index eb5d3979..00000000
--- a/vendor/gems/ruby-openid-2.1.2/lib/openid/consumer/checkid_request.rb
+++ /dev/null
@@ -1,186 +0,0 @@
-require "openid/message"
-require "openid/util"
-
-module OpenID
- class Consumer
- # An object that holds the state necessary for generating an
- # OpenID authentication request. This object holds the association
- # with the server and the discovered information with which the
- # request will be made.
- #
- # It is separate from the consumer because you may wish to add
- # things to the request before sending it on its way to the
- # server. It also has serialization options that let you encode
- # the authentication request as a URL or as a form POST.
- class CheckIDRequest
- attr_accessor :return_to_args, :message
- attr_reader :endpoint
-
- # Users of this library should not create instances of this
- # class. Instances of this class are created by the library
- # when needed.
- def initialize(assoc, endpoint)
- @assoc = assoc
- @endpoint = endpoint
- @return_to_args = {}
- @message = Message.new(endpoint.preferred_namespace)
- @anonymous = false
- end
-
- attr_reader :anonymous
-
- # Set whether this request should be made anonymously. If a
- # request is anonymous, the identifier will not be sent in the
- # request. This is only useful if you are making another kind of
- # request with an extension in this request.
- #
- # Anonymous requests are not allowed when the request is made
- # with OpenID 1.
- def anonymous=(is_anonymous)
- if is_anonymous && @message.is_openid1
- raise ArgumentError, ("OpenID1 requests MUST include the "\
- "identifier in the request")
- end
- @anonymous = is_anonymous
- end
-
- # Add an object that implements the extension interface for
- # adding arguments to an OpenID message to this checkid request.
- #
- # extension_request: an OpenID::Extension object.
- def add_extension(extension_request)
- extension_request.to_message(@message)
- end
-
- # Add an extension argument to this OpenID authentication
- # request. You probably want to use add_extension and the
- # OpenID::Extension interface.
- #
- # Use caution when adding arguments, because they will be
- # URL-escaped and appended to the redirect URL, which can easily
- # get quite long.
- def add_extension_arg(namespace, key, value)
- @message.set_arg(namespace, key, value)
- end
-
- # Produce a OpenID::Message representing this request.
- #
- # Not specifying a return_to URL means that the user will not be
- # returned to the site issuing the request upon its completion.
- #
- # If immediate mode is requested, the OpenID provider is to send
- # back a response immediately, useful for behind-the-scenes
- # authentication attempts. Otherwise the OpenID provider may
- # engage the user before providing a response. This is the
- # default case, as the user may need to provide credentials or
- # approve the request before a positive response can be sent.
- def get_message(realm, return_to=nil, immediate=false)
- if !return_to.nil?
- return_to = Util.append_args(return_to, @return_to_args)
- elsif immediate
- raise ArgumentError, ('"return_to" is mandatory when using '\
- '"checkid_immediate"')
- elsif @message.is_openid1
- raise ArgumentError, ('"return_to" is mandatory for OpenID 1 '\
- 'requests')
- elsif @return_to_args.empty?
- raise ArgumentError, ('extra "return_to" arguments were specified, '\
- 'but no return_to was specified')
- end
-
-
- message = @message.copy
-
- mode = immediate ? 'checkid_immediate' : 'checkid_setup'
- message.set_arg(OPENID_NS, 'mode', mode)
-
- realm_key = message.is_openid1 ? 'trust_root' : 'realm'
- message.set_arg(OPENID_NS, realm_key, realm)
-
- if !return_to.nil?
- message.set_arg(OPENID_NS, 'return_to', return_to)
- end
-
- if not @anonymous
- if @endpoint.is_op_identifier
- # This will never happen when we're in OpenID 1
- # compatibility mode, as long as is_op_identifier()
- # returns false whenever preferred_namespace returns
- # OPENID1_NS.
- claimed_id = request_identity = IDENTIFIER_SELECT
- else
- request_identity = @endpoint.get_local_id
- claimed_id = @endpoint.claimed_id
- end
-
- # This is true for both OpenID 1 and 2
- message.set_arg(OPENID_NS, 'identity', request_identity)
-
- if message.is_openid2
- message.set_arg(OPENID2_NS, 'claimed_id', claimed_id)
- end
- end
-
- if @assoc
- message.set_arg(OPENID_NS, 'assoc_handle', @assoc.handle)
- assoc_log_msg = "with assocication #{@assoc.handle}"
- else
- assoc_log_msg = 'using stateless mode.'
- end
-
- Util.log("Generated #{mode} request to #{@endpoint.server_url} "\
- "#{assoc_log_msg}")
- return message
- end
-
- # Returns a URL with an encoded OpenID request.
- #
- # The resulting URL is the OpenID provider's endpoint URL with
- # parameters appended as query arguments. You should redirect
- # the user agent to this URL.
- #
- # OpenID 2.0 endpoints also accept POST requests, see
- # 'send_redirect?' and 'form_markup'.
- def redirect_url(realm, return_to=nil, immediate=false)
- message = get_message(realm, return_to, immediate)
- return message.to_url(@endpoint.server_url)
- end
-
- # Get html for a form to submit this request to the IDP.
- #
- # form_tag_attrs is a hash of attributes to be added to the form
- # tag. 'accept-charset' and 'enctype' have defaults that can be
- # overridden. If a value is supplied for 'action' or 'method',
- # it will be replaced.
- def form_markup(realm, return_to=nil, immediate=false,
- form_tag_attrs=nil)
- message = get_message(realm, return_to, immediate)
- return message.to_form_markup(@endpoint.server_url, form_tag_attrs)
- end
-
- # Get a complete HTML document that autosubmits the request to the IDP
- # with javascript. This method wraps form_markup - see that method's
- # documentation for help with the parameters.
- def html_markup(realm, return_to=nil, immediate=false,
- form_tag_attrs=nil)
- Util.auto_submit_html(form_markup(realm,
- return_to,
- immediate,
- form_tag_attrs))
- end
-
- # Should this OpenID authentication request be sent as a HTTP
- # redirect or as a POST (form submission)?
- #
- # This takes the same parameters as redirect_url or form_markup
- def send_redirect?(realm, return_to=nil, immediate=false)
- if @endpoint.compatibility_mode
- return true
- else
- url = redirect_url(realm, return_to, immediate)
- return url.length <= OPENID1_URL_LIMIT
- end
- end
- end
- end
-end
diff --git a/vendor/gems/ruby-openid-2.1.2/lib/openid/consumer/discovery.rb b/vendor/gems/ruby-openid-2.1.2/lib/openid/consumer/discovery.rb
deleted file mode 100644
index 986b476f..00000000
--- a/vendor/gems/ruby-openid-2.1.2/lib/openid/consumer/discovery.rb
+++ /dev/null
@@ -1,490 +0,0 @@
-# Functions to discover OpenID endpoints from identifiers.
-
-require 'uri'
-require 'openid/util'
-require 'openid/fetchers'
-require 'openid/urinorm'
-require 'openid/message'
-require 'openid/yadis/discovery'
-require 'openid/yadis/xrds'
-require 'openid/yadis/xri'
-require 'openid/yadis/services'
-require 'openid/yadis/filters'
-require 'openid/consumer/html_parse'
-require 'openid/yadis/xrires'
-
-module OpenID
-
- OPENID_1_0_NS = 'http://openid.net/xmlns/1.0'
- OPENID_IDP_2_0_TYPE = 'http://specs.openid.net/auth/2.0/server'
- OPENID_2_0_TYPE = 'http://specs.openid.net/auth/2.0/signon'
- OPENID_1_1_TYPE = 'http://openid.net/signon/1.1'
- OPENID_1_0_TYPE = 'http://openid.net/signon/1.0'
-
- OPENID_1_0_MESSAGE_NS = OPENID1_NS
- OPENID_2_0_MESSAGE_NS = OPENID2_NS
-
- # Object representing an OpenID service endpoint.
- class OpenIDServiceEndpoint
-
- # OpenID service type URIs, listed in order of preference. The
- # ordering of this list affects yadis and XRI service discovery.
- OPENID_TYPE_URIS = [
- OPENID_IDP_2_0_TYPE,
-
- OPENID_2_0_TYPE,
- OPENID_1_1_TYPE,
- OPENID_1_0_TYPE,
- ]
-
- # the verified identifier.
- attr_accessor :claimed_id
-
- # For XRI, the persistent identifier.
- attr_accessor :canonical_id
-
- attr_accessor :server_url, :type_uris, :local_id, :used_yadis
-
- def initialize
- @claimed_id = nil
- @server_url = nil
- @type_uris = []
- @local_id = nil
- @canonical_id = nil
- @used_yadis = false # whether this came from an XRDS
- @display_identifier = nil
- end
-
- def display_identifier
- return @display_identifier if @display_identifier
-
- return @claimed_id if @claimed_id.nil?
-
- begin
- parsed_identifier = URI.parse(@claimed_id)
- rescue URI::InvalidURIError
- raise ProtocolError, "Claimed identifier #{claimed_id} is not a valid URI"
- end
-
- return @claimed_id if not parsed_identifier.fragment
-
- disp = parsed_identifier
- disp.fragment = nil
-
- return disp.to_s
- end
-
- def display_identifier=(display_identifier)
- @display_identifier = display_identifier
- end
-
- def uses_extension(extension_uri)
- return @type_uris.member?(extension_uri)
- end
-
- def preferred_namespace
- if (@type_uris.member?(OPENID_IDP_2_0_TYPE) or
- @type_uris.member?(OPENID_2_0_TYPE))
- return OPENID_2_0_MESSAGE_NS
- else
- return OPENID_1_0_MESSAGE_NS
- end
- end
-
- def supports_type(type_uri)
- # Does this endpoint support this type?
- #
- # I consider C{/server} endpoints to implicitly support C{/signon}.
- (
- @type_uris.member?(type_uri) or
- (type_uri == OPENID_2_0_TYPE and is_op_identifier())
- )
- end
-
- def compatibility_mode
- return preferred_namespace() != OPENID_2_0_MESSAGE_NS
- end
-
- def is_op_identifier
- return @type_uris.member?(OPENID_IDP_2_0_TYPE)
- end
-
- def parse_service(yadis_url, uri, type_uris, service_element)
- # Set the state of this object based on the contents of the
- # service element.
- @type_uris = type_uris
- @server_url = uri
- @used_yadis = true
-
- if !is_op_identifier()
- # XXX: This has crappy implications for Service elements that
- # contain both 'server' and 'signon' Types. But that's a
- # pathological configuration anyway, so I don't think I care.
- @local_id = OpenID.find_op_local_identifier(service_element,
- @type_uris)
- @claimed_id = yadis_url
- end
- end
-
- def get_local_id
- # Return the identifier that should be sent as the
- # openid.identity parameter to the server.
- if @local_id.nil? and @canonical_id.nil?
- return @claimed_id
- else
- return (@local_id or @canonical_id)
- end
- end
-
- def self.from_basic_service_endpoint(endpoint)
- # Create a new instance of this class from the endpoint object
- # passed in.
- #
- # @return: nil or OpenIDServiceEndpoint for this endpoint object"""
-
- type_uris = endpoint.match_types(OPENID_TYPE_URIS)
-
- # If any Type URIs match and there is an endpoint URI specified,
- # then this is an OpenID endpoint
- if (!type_uris.nil? and !type_uris.empty?) and !endpoint.uri.nil?
- openid_endpoint = self.new
- openid_endpoint.parse_service(
- endpoint.yadis_url,
- endpoint.uri,
- endpoint.type_uris,
- endpoint.service_element)
- else
- openid_endpoint = nil
- end
-
- return openid_endpoint
- end
-
- def self.from_html(uri, html)
- # Parse the given document as HTML looking for an OpenID
- #
- # @rtype: [OpenIDServiceEndpoint]
-
- discovery_types = [
- [OPENID_2_0_TYPE, 'openid2.provider', 'openid2.local_id'],
- [OPENID_1_1_TYPE, 'openid.server', 'openid.delegate'],
- ]
-
- link_attrs = OpenID.parse_link_attrs(html)
- services = []
- discovery_types.each { |type_uri, op_endpoint_rel, local_id_rel|
-
- op_endpoint_url = OpenID.find_first_href(link_attrs, op_endpoint_rel)
-
- if !op_endpoint_url
- next
- end
-
- service = self.new
- service.claimed_id = uri
- service.local_id = OpenID.find_first_href(link_attrs, local_id_rel)
- service.server_url = op_endpoint_url
- service.type_uris = [type_uri]
-
- services << service
- }
-
- return services
- end
-
- def self.from_xrds(uri, xrds)
- # Parse the given document as XRDS looking for OpenID services.
- #
- # @rtype: [OpenIDServiceEndpoint]
- #
- # @raises L{XRDSError}: When the XRDS does not parse.
- return Yadis::apply_filter(uri, xrds, self)
- end
-
- def self.from_discovery_result(discoveryResult)
- # Create endpoints from a DiscoveryResult.
- #
- # @type discoveryResult: L{DiscoveryResult}
- #
- # @rtype: list of L{OpenIDServiceEndpoint}
- #
- # @raises L{XRDSError}: When the XRDS does not parse.
- if discoveryResult.is_xrds()
- meth = self.method('from_xrds')
- else
- meth = self.method('from_html')
- end
-
- return meth.call(discoveryResult.normalized_uri,
- discoveryResult.response_text)
- end
-
- def self.from_op_endpoint_url(op_endpoint_url)
- # Construct an OP-Identifier OpenIDServiceEndpoint object for
- # a given OP Endpoint URL
- #
- # @param op_endpoint_url: The URL of the endpoint
- # @rtype: OpenIDServiceEndpoint
- service = self.new
- service.server_url = op_endpoint_url
- service.type_uris = [OPENID_IDP_2_0_TYPE]
- return service
- end
-
- def to_s
- return sprintf("<%s server_url=%s claimed_id=%s " +
- "local_id=%s canonical_id=%s used_yadis=%s>",
- self.class, @server_url, @claimed_id,
- @local_id, @canonical_id, @used_yadis)
- end
- end
-
- def self.find_op_local_identifier(service_element, type_uris)
- # Find the OP-Local Identifier for this xrd:Service element.
- #
- # This considers openid:Delegate to be a synonym for xrd:LocalID
- # if both OpenID 1.X and OpenID 2.0 types are present. If only
- # OpenID 1.X is present, it returns the value of
- # openid:Delegate. If only OpenID 2.0 is present, it returns the
- # value of xrd:LocalID. If there is more than one LocalID tag and
- # the values are different, it raises a DiscoveryFailure. This is
- # also triggered when the xrd:LocalID and openid:Delegate tags are
- # different.
-
- # XXX: Test this function on its own!
-
- # Build the list of tags that could contain the OP-Local
- # Identifier
- local_id_tags = []
- if type_uris.member?(OPENID_1_1_TYPE) or
- type_uris.member?(OPENID_1_0_TYPE)
- # local_id_tags << Yadis::nsTag(OPENID_1_0_NS, 'openid', 'Delegate')
- service_element.add_namespace('openid', OPENID_1_0_NS)
- local_id_tags << "openid:Delegate"
- end
-
- if type_uris.member?(OPENID_2_0_TYPE)
- # local_id_tags.append(Yadis::nsTag(XRD_NS_2_0, 'xrd', 'LocalID'))
- service_element.add_namespace('xrd', Yadis::XRD_NS_2_0)
- local_id_tags << "xrd:LocalID"
- end
-
- # Walk through all the matching tags and make sure that they all
- # have the same value
- local_id = nil
- local_id_tags.each { |local_id_tag|
- service_element.each_element(local_id_tag) { |local_id_element|
- if local_id.nil?
- local_id = local_id_element.text
- elsif local_id != local_id_element.text
- format = 'More than one %s tag found in one service element'
- message = sprintf(format, local_id_tag)
- raise DiscoveryFailure.new(message, nil)
- end
- }
- }
-
- return local_id
- end
-
- def self.normalize_url(url)
- # Normalize a URL, converting normalization failures to
- # DiscoveryFailure
- begin
- normalized = URINorm.urinorm(url)
- rescue URI::Error => why
- raise DiscoveryFailure.new("Error normalizing #{url}: #{why.message}", nil)
- else
- defragged = URI::parse(normalized)
- defragged.fragment = nil
- return defragged.normalize.to_s
- end
- end
-
- def self.best_matching_service(service, preferred_types)
- # Return the index of the first matching type, or something higher
- # if no type matches.
- #
- # This provides an ordering in which service elements that contain
- # a type that comes earlier in the preferred types list come
- # before service elements that come later. If a service element
- # has more than one type, the most preferred one wins.
- preferred_types.each_with_index { |value, index|
- if service.type_uris.member?(value)
- return index
- end
- }
-
- return preferred_types.length
- end
-
- def self.arrange_by_type(service_list, preferred_types)
- # Rearrange service_list in a new list so services are ordered by
- # types listed in preferred_types. Return the new list.
-
- # Build a list with the service elements in tuples whose
- # comparison will prefer the one with the best matching service
- prio_services = []
-
- service_list.each_with_index { |s, index|
- prio_services << [best_matching_service(s, preferred_types), index, s]
- }
-
- prio_services.sort!
-
- # Now that the services are sorted by priority, remove the sort
- # keys from the list.
- (0...prio_services.length).each { |i|
- prio_services[i] = prio_services[i][2]
- }
-
- return prio_services
- end
-
- def self.get_op_or_user_services(openid_services)
- # Extract OP Identifier services. If none found, return the rest,
- # sorted with most preferred first according to
- # OpenIDServiceEndpoint.openid_type_uris.
- #
- # openid_services is a list of OpenIDServiceEndpoint objects.
- #
- # Returns a list of OpenIDServiceEndpoint objects.
-
- op_services = arrange_by_type(openid_services, [OPENID_IDP_2_0_TYPE])
-
- openid_services = arrange_by_type(openid_services,
- OpenIDServiceEndpoint::OPENID_TYPE_URIS)
-
- if !op_services.empty?
- return op_services
- else
- return openid_services
- end
- end
-
- def self.discover_yadis(uri)
- # Discover OpenID services for a URI. Tries Yadis and falls back
- # on old-style discovery if Yadis fails.
- #
- # @param uri: normalized identity URL
- # @type uri: str
- #
- # @return: (claimed_id, services)
- # @rtype: (str, list(OpenIDServiceEndpoint))
- #
- # @raises DiscoveryFailure: when discovery fails.
-
- # Might raise a yadis.discover.DiscoveryFailure if no document
- # came back for that URI at all. I don't think falling back to
- # OpenID 1.0 discovery on the same URL will help, so don't bother
- # to catch it.
- response = Yadis.discover(uri)
-
- yadis_url = response.normalized_uri
- body = response.response_text
-
- begin
- openid_services = OpenIDServiceEndpoint.from_xrds(yadis_url, body)
- rescue Yadis::XRDSError
- # Does not parse as a Yadis XRDS file
- openid_services = []
- end
-
- if openid_services.empty?
- # Either not an XRDS or there are no OpenID services.
-
- if response.is_xrds
- # if we got the Yadis content-type or followed the Yadis
- # header, re-fetch the document without following the Yadis
- # header, with no Accept header.
- return self.discover_no_yadis(uri)
- end
-
- # Try to parse the response as HTML.
- #
- openid_services = OpenIDServiceEndpoint.from_html(yadis_url, body)
- end
-
- return [yadis_url, self.get_op_or_user_services(openid_services)]
- end
-
- def self.discover_xri(iname)
- endpoints = []
-
- begin
- canonical_id, services = Yadis::XRI::ProxyResolver.new().query(
- iname, OpenIDServiceEndpoint::OPENID_TYPE_URIS)
-
- if canonical_id.nil?
- raise Yadis::XRDSError.new(sprintf('No CanonicalID found for XRI %s', iname))
- end
-
- flt = Yadis.make_filter(OpenIDServiceEndpoint)
-
- services.each { |service_element|
- endpoints += flt.get_service_endpoints(iname, service_element)
- }
- rescue Yadis::XRDSError => why
- Util.log('xrds error on ' + iname + ': ' + why.to_s)
- end
-
- endpoints.each { |endpoint|
- # Is there a way to pass this through the filter to the endpoint
- # constructor instead of tacking it on after?
- endpoint.canonical_id = canonical_id
- endpoint.claimed_id = canonical_id
- endpoint.display_identifier = iname
- }
-
- # FIXME: returned xri should probably be in some normal form
- return [iname, self.get_op_or_user_services(endpoints)]
- end
-
- def self.discover_no_yadis(uri)
- http_resp = OpenID.fetch(uri)
- if http_resp.code != "200" and http_resp.code != "206"
- raise DiscoveryFailure.new(
- "HTTP Response status from identity URL host is not \"200\". "\
- "Got status #{http_resp.code.inspect}", http_resp)
- end
-
- claimed_id = http_resp.final_url
- openid_services = OpenIDServiceEndpoint.from_html(
- claimed_id, http_resp.body)
- return [claimed_id, openid_services]
- end
-
- def self.discover_uri(uri)
- # Hack to work around URI parsing for URls with *no* scheme.
- if uri.index("://").nil?
- uri = 'http://' + uri
- end
-
- begin
- parsed = URI::parse(uri)
- rescue URI::InvalidURIError => why
- raise DiscoveryFailure.new("URI is not valid: #{why.message}", nil)
- end
-
- if !parsed.scheme.nil? and !parsed.scheme.empty?
- if !['http', 'https'].member?(parsed.scheme)
- raise DiscoveryFailure.new(
- "URI scheme #{parsed.scheme} is not HTTP or HTTPS", nil)
- end
- end
-
- uri = self.normalize_url(uri)
- claimed_id, openid_services = self.discover_yadis(uri)
- claimed_id = self.normalize_url(claimed_id)
- return [claimed_id, openid_services]
- end
-
- def self.discover(identifier)
- if Yadis::XRI::identifier_scheme(identifier) == :xri
- normalized_identifier, services = discover_xri(identifier)
- else
- return discover_uri(identifier)
- end
- end
-end
diff --git a/vendor/gems/ruby-openid-2.1.2/lib/openid/consumer/discovery_manager.rb b/vendor/gems/ruby-openid-2.1.2/lib/openid/consumer/discovery_manager.rb
deleted file mode 100644
index 8f838117..00000000
--- a/vendor/gems/ruby-openid-2.1.2/lib/openid/consumer/discovery_manager.rb
+++ /dev/null
@@ -1,123 +0,0 @@
-module OpenID
- class Consumer
-
- # A set of discovered services, for tracking which providers have
- # been attempted for an OpenID identifier
- class DiscoveredServices
- attr_reader :current
-
- def initialize(starting_url, yadis_url, services)
- @starting_url = starting_url
- @yadis_url = yadis_url
- @services = services.dup
- @current = nil
- end
-
- def next
- @current = @services.shift
- end
-
- def for_url?(url)
- [@starting_url, @yadis_url].member?(url)
- end
-
- def started?
- !@current.nil?
- end
-
- def empty?
- @services.empty?
- end
- end
-
- # Manages calling discovery and tracking which endpoints have
- # already been attempted.
- class DiscoveryManager
- def initialize(session, url, session_key_suffix=nil)
- @url = url
-
- @session = session
- @session_key_suffix = session_key_suffix || 'auth'
- end
-
- def get_next_service
- manager = get_manager
- if !manager.nil? && manager.empty?
- destroy_manager
- manager = nil
- end
-
- if manager.nil?
- yadis_url, services = yield @url
- manager = create_manager(yadis_url, services)
- end
-
- if !manager.nil?
- service = manager.next
- store(manager)
- else
- service = nil
- end
-
- return service
- end
-
- def cleanup(force=false)
- manager = get_manager(force)
- if !manager.nil?
- service = manager.current
- destroy_manager(force)
- else
- service = nil
- end
- return service
- end
-
- protected
-
- def get_manager(force=false)
- manager = load
- if force || manager.nil? || manager.for_url?(@url)
- return manager
- else
- return nil
- end
- end
-
- def create_manager(yadis_url, services)
- manager = get_manager
- if !manager.nil?
- raise StandardError, "There is already a manager for #{yadis_url}"
- end
- if services.empty?
- return nil
- end
- manager = DiscoveredServices.new(@url, yadis_url, services)
- store(manager)
- return manager
- end
-
- def destroy_manager(force=false)
- if !get_manager(force).nil?
- destroy!
- end
- end
-
- def session_key
- 'OpenID::Consumer::DiscoveredServices::' + @session_key_suffix
- end
-
- def store(manager)
- @session[session_key] = manager
- end
-
- def load
- @session[session_key]
- end
-
- def destroy!
- @session[session_key] = nil
- end
- end
- end
-end
diff --git a/vendor/gems/ruby-openid-2.1.2/lib/openid/consumer/html_parse.rb b/vendor/gems/ruby-openid-2.1.2/lib/openid/consumer/html_parse.rb
deleted file mode 100644
index 579874ca..00000000
--- a/vendor/gems/ruby-openid-2.1.2/lib/openid/consumer/html_parse.rb
+++ /dev/null
@@ -1,134 +0,0 @@
-require "openid/yadis/htmltokenizer"
-
-module OpenID
-
- # Stuff to remove before we start looking for tags
- REMOVED_RE = /
- # Comments
-
-
- # CDATA blocks
- |
-
- # script blocks
- |
-
-
-"
- end
- end
-
-end
diff --git a/vendor/gems/ruby-openid-2.1.2/lib/openid/yadis/accept.rb b/vendor/gems/ruby-openid-2.1.2/lib/openid/yadis/accept.rb
deleted file mode 100644
index a1657482..00000000
--- a/vendor/gems/ruby-openid-2.1.2/lib/openid/yadis/accept.rb
+++ /dev/null
@@ -1,148 +0,0 @@
-module OpenID
-
- module Yadis
-
- # Generate an accept header value
- #
- # [str or (str, float)] -> str
- def self.generate_accept_header(*elements)
- parts = []
- elements.each { |element|
- if element.is_a?(String)
- qs = "1.0"
- mtype = element
- else
- mtype, q = element
- q = q.to_f
- if q > 1 or q <= 0
- raise ArgumentError.new("Invalid preference factor: #{q}")
- end
- qs = sprintf("%0.1f", q)
- end
-
- parts << [qs, mtype]
- }
-
- parts.sort!
- chunks = []
- parts.each { |q, mtype|
- if q == '1.0'
- chunks << mtype
- else
- chunks << sprintf("%s; q=%s", mtype, q)
- end
- }
-
- return chunks.join(', ')
- end
-
- def self.parse_accept_header(value)
- # Parse an accept header, ignoring any accept-extensions
- #
- # returns a list of tuples containing main MIME type, MIME
- # subtype, and quality markdown.
- #
- # str -> [(str, str, float)]
- chunks = value.split(',', -1).collect { |v| v.strip }
- accept = []
- chunks.each { |chunk|
- parts = chunk.split(";", -1).collect { |s| s.strip }
-
- mtype = parts.shift
- if mtype.index('/').nil?
- # This is not a MIME type, so ignore the bad data
- next
- end
-
- main, sub = mtype.split('/', 2)
-
- q = nil
- parts.each { |ext|
- if !ext.index('=').nil?
- k, v = ext.split('=', 2)
- if k == 'q'
- q = v.to_f
- end
- end
- }
-
- q = 1.0 if q.nil?
-
- accept << [q, main, sub]
- }
-
- accept.sort!
- accept.reverse!
-
- return accept.collect { |q, main, sub| [main, sub, q] }
- end
-
- def self.match_types(accept_types, have_types)
- # Given the result of parsing an Accept: header, and the
- # available MIME types, return the acceptable types with their
- # quality markdowns.
- #
- # For example:
- #
- # >>> acceptable = parse_accept_header('text/html, text/plain; q=0.5')
- # >>> matchTypes(acceptable, ['text/plain', 'text/html', 'image/jpeg'])
- # [('text/html', 1.0), ('text/plain', 0.5)]
- #
- # Type signature: ([(str, str, float)], [str]) -> [(str, float)]
- if accept_types.nil? or accept_types == []
- # Accept all of them
- default = 1
- else
- default = 0
- end
-
- match_main = {}
- match_sub = {}
- accept_types.each { |main, sub, q|
- if main == '*'
- default = [default, q].max
- next
- elsif sub == '*'
- match_main[main] = [match_main.fetch(main, 0), q].max
- else
- match_sub[[main, sub]] = [match_sub.fetch([main, sub], 0), q].max
- end
- }
-
- accepted_list = []
- order_maintainer = 0
- have_types.each { |mtype|
- main, sub = mtype.split('/', 2)
- if match_sub.member?([main, sub])
- q = match_sub[[main, sub]]
- else
- q = match_main.fetch(main, default)
- end
-
- if q != 0
- accepted_list << [1 - q, order_maintainer, q, mtype]
- order_maintainer += 1
- end
- }
-
- accepted_list.sort!
- return accepted_list.collect { |_, _, q, mtype| [mtype, q] }
- end
-
- def self.get_acceptable(accept_header, have_types)
- # Parse the accept header and return a list of available types
- # in preferred order. If a type is unacceptable, it will not be
- # in the resulting list.
- #
- # This is a convenience wrapper around matchTypes and
- # parse_accept_header
- #
- # (str, [str]) -> [str]
- accepted = self.parse_accept_header(accept_header)
- preferred = self.match_types(accepted, have_types)
- return preferred.collect { |mtype, _| mtype }
- end
-
- end
-
-end
diff --git a/vendor/gems/ruby-openid-2.1.2/lib/openid/yadis/constants.rb b/vendor/gems/ruby-openid-2.1.2/lib/openid/yadis/constants.rb
deleted file mode 100644
index 99b58b13..00000000
--- a/vendor/gems/ruby-openid-2.1.2/lib/openid/yadis/constants.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-
-require 'openid/yadis/accept'
-
-module OpenID
-
- module Yadis
-
- YADIS_HEADER_NAME = 'X-XRDS-Location'
- YADIS_CONTENT_TYPE = 'application/xrds+xml'
-
- # A value suitable for using as an accept header when performing
- # YADIS discovery, unless the application has special requirements
- YADIS_ACCEPT_HEADER = generate_accept_header(
- ['text/html', 0.3],
- ['application/xhtml+xml', 0.5],
- [YADIS_CONTENT_TYPE, 1.0]
- )
-
- end
-
-end
diff --git a/vendor/gems/ruby-openid-2.1.2/lib/openid/yadis/discovery.rb b/vendor/gems/ruby-openid-2.1.2/lib/openid/yadis/discovery.rb
deleted file mode 100644
index 55d6f09b..00000000
--- a/vendor/gems/ruby-openid-2.1.2/lib/openid/yadis/discovery.rb
+++ /dev/null
@@ -1,153 +0,0 @@
-
-require 'openid/util'
-require 'openid/fetchers'
-require 'openid/yadis/constants'
-require 'openid/yadis/parsehtml'
-
-module OpenID
-
- # Raised when a error occurs in the discovery process
- class DiscoveryFailure < OpenIDError
- attr_accessor :identity_url, :http_response
-
- def initialize(message, http_response)
- super(message)
- @identity_url = nil
- @http_response = http_response
- end
- end
-
- module Yadis
-
- # Contains the result of performing Yadis discovery on a URI
- class DiscoveryResult
-
- # The result of following redirects from the request_uri
- attr_accessor :normalize_uri
-
- # The URI from which the response text was returned (set to
- # nil if there was no XRDS document found)
- attr_accessor :xrds_uri
-
- # The content-type returned with the response_text
- attr_accessor :content_type
-
- # The document returned from the xrds_uri
- attr_accessor :response_text
-
- attr_accessor :request_uri, :normalized_uri
-
- def initialize(request_uri)
- # Initialize the state of the object
- #
- # sets all attributes to None except the request_uri
- @request_uri = request_uri
- @normalized_uri = nil
- @xrds_uri = nil
- @content_type = nil
- @response_text = nil
- end
-
- # Was the Yadis protocol's indirection used?
- def used_yadis_location?
- return @normalized_uri != @xrds_uri
- end
-
- # Is the response text supposed to be an XRDS document?
- def is_xrds
- return (used_yadis_location?() or
- @content_type == YADIS_CONTENT_TYPE)
- end
- end
-
- # Discover services for a given URI.
- #
- # uri: The identity URI as a well-formed http or https URI. The
- # well-formedness and the protocol are not checked, but the
- # results of this function are undefined if those properties do
- # not hold.
- #
- # returns a DiscoveryResult object
- #
- # Raises DiscoveryFailure when the HTTP response does not have
- # a 200 code.
- def self.discover(uri)
- result = DiscoveryResult.new(uri)
- begin
- resp = OpenID.fetch(uri, nil, {'Accept' => YADIS_ACCEPT_HEADER})
- rescue Exception
- raise DiscoveryFailure.new("Failed to fetch identity URL #{uri} : #{$!}", $!)
- end
- if resp.code != "200" and resp.code != "206"
- raise DiscoveryFailure.new(
- "HTTP Response status from identity URL host is not \"200\"."\
- "Got status #{resp.code.inspect} for #{resp.final_url}", resp)
- end
-
- # Note the URL after following redirects
- result.normalized_uri = resp.final_url
-
- # Attempt to find out where to go to discover the document or if
- # we already have it
- result.content_type = resp['content-type']
-
- result.xrds_uri = self.where_is_yadis?(resp)
-
- if result.xrds_uri and result.used_yadis_location?
- begin
- resp = OpenID.fetch(result.xrds_uri)
- rescue
- raise DiscoveryFailure.new("Failed to fetch Yadis URL #{result.xrds_uri} : #{$!}", $!)
- end
- if resp.code != "200" and resp.code != "206"
- exc = DiscoveryFailure.new(
- "HTTP Response status from Yadis host is not \"200\". " +
- "Got status #{resp.code.inspect} for #{resp.final_url}", resp)
- exc.identity_url = result.normalized_uri
- raise exc
- end
-
- result.content_type = resp['content-type']
- end
-
- result.response_text = resp.body
- return result
- end
-
- # Given a HTTPResponse, return the location of the Yadis
- # document.
- #
- # May be the URL just retrieved, another URL, or None, if I
- # can't find any.
- #
- # [non-blocking]
- def self.where_is_yadis?(resp)
- # Attempt to find out where to go to discover the document or if
- # we already have it
- content_type = resp['content-type']
-
- # According to the spec, the content-type header must be an
- # exact match, or else we have to look for an indirection.
- if (!content_type.nil? and !content_type.to_s.empty? and
- content_type.split(';', 2)[0].downcase == YADIS_CONTENT_TYPE)
- return resp.final_url
- else
- # Try the header
- yadis_loc = resp[YADIS_HEADER_NAME.downcase]
-
- if yadis_loc.nil?
- # Parse as HTML if the header is missing.
- #
- # XXX: do we want to do something with content-type, like
- # have a whitelist or a blacklist (for detecting that it's
- # HTML)?
- yadis_loc = Yadis.html_yadis_location(resp.body)
- end
- end
-
- return yadis_loc
- end
-
- end
-
-end
diff --git a/vendor/gems/ruby-openid-2.1.2/lib/openid/yadis/filters.rb b/vendor/gems/ruby-openid-2.1.2/lib/openid/yadis/filters.rb
deleted file mode 100644
index 90f350ea..00000000
--- a/vendor/gems/ruby-openid-2.1.2/lib/openid/yadis/filters.rb
+++ /dev/null
@@ -1,205 +0,0 @@
-# This file contains functions and classes used for extracting
-# endpoint information out of a Yadis XRD file using the REXML
-# XML parser.
-
-#
-module OpenID
- module Yadis
- class BasicServiceEndpoint
- attr_reader :type_uris, :yadis_url, :uri, :service_element
-
- # Generic endpoint object that contains parsed service
- # information, as well as a reference to the service element
- # from which it was generated. If there is more than one
- # xrd:Type or xrd:URI in the xrd:Service, this object represents
- # just one of those pairs.
- #
- # This object can be used as a filter, because it implements
- # fromBasicServiceEndpoint.
- #
- # The simplest kind of filter you can write implements
- # fromBasicServiceEndpoint, which takes one of these objects.
- def initialize(yadis_url, type_uris, uri, service_element)
- @type_uris = type_uris
- @yadis_url = yadis_url
- @uri = uri
- @service_element = service_element
- end
-
- # Query this endpoint to see if it has any of the given type
- # URIs. This is useful for implementing other endpoint classes
- # that e.g. need to check for the presence of multiple
- # versions of a single protocol.
- def match_types(type_uris)
- return @type_uris & type_uris
- end
-
- # Trivial transform from a basic endpoint to itself. This
- # method exists to allow BasicServiceEndpoint to be used as a
- # filter.
- #
- # If you are subclassing this object, re-implement this function.
- def self.from_basic_service_endpoint(endpoint)
- return endpoint
- end
-
- # A hack to make both this class and its instances respond to
- # this message since Ruby doesn't support static methods.
- def from_basic_service_endpoint(endpoint)
- return self.class.from_basic_service_endpoint(endpoint)
- end
-
- end
-
- # Take a list of basic filters and makes a filter that
- # transforms the basic filter into a top-level filter. This is
- # mostly useful for the implementation of make_filter, which
- # should only be needed for special cases or internal use by
- # this library.
- #
- # This object is useful for creating simple filters for services
- # that use one URI and are specified by one Type (we expect most
- # Types will fit this paradigm).
- #
- # Creates a BasicServiceEndpoint object and apply the filter
- # functions to it until one of them returns a value.
- class TransformFilterMaker
- attr_reader :filter_procs
-
- # Initialize the filter maker's state
- #
- # filter_functions are the endpoint transformer
- # Procs to apply to the basic endpoint. These are called in
- # turn until one of them does not return nil, and the result
- # of that transformer is returned.
- def initialize(filter_procs)
- @filter_procs = filter_procs
- end
-
- # Returns an array of endpoint objects produced by the
- # filter procs.
- def get_service_endpoints(yadis_url, service_element)
- endpoints = []
-
- # Do an expansion of the service element by xrd:Type and
- # xrd:URI
- Yadis::expand_service(service_element).each { |type_uris, uri, _|
- # Create a basic endpoint object to represent this
- # yadis_url, Service, Type, URI combination
- endpoint = BasicServiceEndpoint.new(
- yadis_url, type_uris, uri, service_element)
-
- e = apply_filters(endpoint)
- if !e.nil?
- endpoints << e
- end
- }
- return endpoints
- end
-
- def apply_filters(endpoint)
- # Apply filter procs to an endpoint until one of them returns
- # non-nil.
- @filter_procs.each { |filter_proc|
- e = filter_proc.call(endpoint)
- if !e.nil?
- # Once one of the filters has returned an endpoint, do not
- # apply any more.
- return e
- end
- }
-
- return nil
- end
- end
-
- class CompoundFilter
- attr_reader :subfilters
-
- # Create a new filter that applies a set of filters to an
- # endpoint and collects their results.
- def initialize(subfilters)
- @subfilters = subfilters
- end
-
- # Generate all endpoint objects for all of the subfilters of
- # this filter and return their concatenation.
- def get_service_endpoints(yadis_url, service_element)
- endpoints = []
- @subfilters.each { |subfilter|
- endpoints += subfilter.get_service_endpoints(yadis_url, service_element)
- }
- return endpoints
- end
- end
-
- # Exception raised when something is not able to be turned into a
- # filter
- @@filter_type_error = TypeError.new(
- 'Expected a filter, an endpoint, a callable or a list of any of these.')
-
- # Convert a filter-convertable thing into a filter
- #
- # parts should be a filter, an endpoint, a callable, or a list of
- # any of these.
- def self.make_filter(parts)
- # Convert the parts into a list, and pass to mk_compound_filter
- if parts.nil?
- parts = [BasicServiceEndpoint]
- end
-
- if parts.is_a?(Array)
- return mk_compound_filter(parts)
- else
- return mk_compound_filter([parts])
- end
- end
-
- # Create a filter out of a list of filter-like things
- #
- # Used by make_filter
- #
- # parts should be a list of things that can be passed to make_filter
- def self.mk_compound_filter(parts)
-
- if !parts.respond_to?('each')
- raise TypeError, "#{parts.inspect} is not iterable"
- end
-
- # Separate into a list of callables and a list of filter objects
- transformers = []
- filters = []
- parts.each { |subfilter|
- if !subfilter.is_a?(Array)
- # If it's not an iterable
- if subfilter.respond_to?('get_service_endpoints')
- # It's a full filter
- filters << subfilter
- elsif subfilter.respond_to?('from_basic_service_endpoint')
- # It's an endpoint object, so put its endpoint conversion
- # attribute into the list of endpoint transformers
- transformers << subfilter.method('from_basic_service_endpoint')
- elsif subfilter.respond_to?('call')
- # It's a proc, so add it to the list of endpoint
- # transformers
- transformers << subfilter
- else
- raise @@filter_type_error
- end
- else
- filters << mk_compound_filter(subfilter)
- end
- }
-
- if transformers.length > 0
- filters << TransformFilterMaker.new(transformers)
- end
-
- if filters.length == 1
- return filters[0]
- else
- return CompoundFilter.new(filters)
- end
- end
- end
-end
diff --git a/vendor/gems/ruby-openid-2.1.2/lib/openid/yadis/htmltokenizer.rb b/vendor/gems/ruby-openid-2.1.2/lib/openid/yadis/htmltokenizer.rb
deleted file mode 100644
index b2081097..00000000
--- a/vendor/gems/ruby-openid-2.1.2/lib/openid/yadis/htmltokenizer.rb
+++ /dev/null
@@ -1,305 +0,0 @@
-# = HTMLTokenizer
-#
-# Author:: Ben Giddings (mailto:bg-rubyforge@infofiend.com)
-# Copyright:: Copyright (c) 2004 Ben Giddings
-# License:: Distributes under the same terms as Ruby
-#
-#
-# This is a partial port of the functionality behind Perl's TokeParser
-# Provided a page it progressively returns tokens from that page
-#
-# $Id: htmltokenizer.rb,v 1.7 2005/06/07 21:05:53 merc Exp $
-
-#
-# A class to tokenize HTML.
-#
-# Example:
-#
-# page = "
-#
-# This is the title
-#
-#
-#
-# This is the header
-#
-# This is the paragraph, it contains
-# links,
-#
. Ok, here is some more text and
-# another link.
-#
-#
-#
-# "
-# toke = HTMLTokenizer.new(page)
-#
-# assert("
-
-
-
-
-Name: Plain vanilla
-Link:
-
-
-
-
-
-
-Name: Ignore tags in the namespace
-Link*:
-
-
-
-
-
-
-
-
-Name: Short link tag
-Link:
-
-
-
-
-
-
-Name: Spaces in the HTML tag
-Link:
-
-
-
-
-
-
-Name: Spaces in the head tag
-Link:
-
-
-
-
-
-
-Name: Spaces in the link tag
-Link:
-
-
-
-
-
-
-Name: No whitespace
-Link:
-
-
-
-
-Name: Closed head tag
-Link:
-
-
-
-
-
-
-
-Name: One good, one bad (after close head)
-Link:
-
-
-
-
-
-
-
-
-Name: One good, one bad (after open body)
-Link:
-
-
-
-
-
-
-
-
-Name: ill formed (missing close head)
-Link:
-
-
-
-
-
-
-
-Name: Ill formed (no close head, link after )
-Link:
-
-
-
-
-
-
-
-
-Name: Ignore random tags inside of html
-Link:
-
-
-
-
-
-
-
-
-Name: case-folding
-Link*:
-
-
-
-
-
-
-Name: unexpected tags
-Link:
-
-
-
-
-
-
-
-
-
-Name: un-closed script tags
-Link*:
-
-
-
-
-
-None
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Public Instance methods
-
-
-
-
-
-
-
-
[Source]
-
-
-
-50: def record
-51: dir = record_table
-52:
-53: @result = {'resultDir' => dir}
-54: for p in ['result', 'numTestFailures', 'numTestPasses', 'numCommandFailures', 'numCommandPasses', 'numCommandErrors', 'totalTime']
-55: @result[p] = params[p]
-56: end
-57: File.open(log_path(params[:logFile] || 'default.yml'), 'w') {|f| YAML.dump(@result, f)}
-58:
-59: render :file => view_path('record.rhtml'), :layout => layout_path
-60: end
-
-
-
-
-
-
-
-
-
-
-
-
[Source]
-
-
-
- 7: def setup
- 8: unless params.has_key? :keep_session
- 9: reset_session
-10: @session_wiped = true
-11: end
-12: @cleared_tables = clear_tables params[:clear_tables].to_s
-13: @loaded_fixtures = load_fixtures params[:fixtures].to_s
-14: render :file => view_path('setup.rhtml'), :layout => layout_path
-15: end
-
-
-
-
-
-
-
-
-
-
-
-
[Source]
-
-
-
-34: def support_file
-35: if params[:filename].empty?
-36: redirect_to :filename => 'TestRunner.html', :test => 'tests'
-37: return
-38: end
-39:
-40: filename = File.join selenium_path, params[:filename]
-41: if File.file? filename
-42: type = WEBrick::HTTPUtils::DefaultMimeTypes[$1.downcase] if filename =~ /\.(\w+)$/
-43: type ||= 'text/html'
-44: send_file filename, :type => type, :disposition => 'inline', :stream => false
-45: else
-46: render :text => 'Not found', :status => 404
-47: end
-48: end
-
-
-
-
-
-
-
-
-
-
-
-
[Source]
-
-
-
-17: def test_file
-18: params[:testname] = '' if params[:testname].to_s == 'TestSuite.html'
-19: filename = File.join selenium_tests_path, params[:testname]
-20: if File.directory? filename
-21: @suite_path = filename
-22: render :file => view_path('test_suite.rhtml'), :layout => layout_path
-23: elsif File.readable? filename
-24: render_test_case filename
-25: else
-26: if File.directory? selenium_tests_path
-27: render :text => 'Not found', :status => 404
-28: else
-29: render :text => "Did not find the Selenium tests path (#{selenium_tests_path}). Run script/generate selenium", :status => 404
-30: end
-31: end
-32: end
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/doc/classes/SeleniumHelper.html b/vendor/plugins/selenium-on-rails/doc/classes/SeleniumHelper.html
deleted file mode 100644
index ab8fd2c4..00000000
--- a/vendor/plugins/selenium-on-rails/doc/classes/SeleniumHelper.html
+++ /dev/null
@@ -1,148 +0,0 @@
-
-
-
-
-
- Module: SeleniumHelper
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Public Instance methods
-
-
-
-
-
-
-
-
[Source]
-
-
-
-5: def test_case_name filename
-6: File.basename(filename).sub(/\..*/,'').humanize
-7: end
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails.html b/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails.html
deleted file mode 100644
index ecb45eb3..00000000
--- a/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails.html
+++ /dev/null
@@ -1,126 +0,0 @@
-
-
-
-
-
- Module: SeleniumOnRails
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/FixtureLoader.html b/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/FixtureLoader.html
deleted file mode 100644
index c49a8bbc..00000000
--- a/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/FixtureLoader.html
+++ /dev/null
@@ -1,231 +0,0 @@
-
-
-
-
-
- Module: SeleniumOnRails::FixtureLoader
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Public Instance methods
-
-
-
-
-
-
-
-
[Source]
-
-
-
- 7: def available_fixtures
- 8: fixtures = {}
- 9: path = fixtures_path + '/'
-10: files = Dir["#{path}**/*.{yml,csv}"]
-11: files.each do |file|
-12: rel_path = file.sub(path, '')
-13: next if skip_file? rel_path
-14: fixture_set = File.dirname(rel_path)
-15: fixture_set = '' if fixture_set == '.'
-16: fixture = rel_path.sub /\.[^.]*$/, ''
-17: fixtures[fixture_set] ||= []
-18: fixtures[fixture_set] << fixture
-19: end
-20:
-21: fixtures
-22: end
-
-
-
-
-
-
-
-
-
-
-
-
[Source]
-
-
-
-46: def clear_tables tables
-47: table_names = tables.split /\s*,\s*/
-48: connection = ActiveRecord::Base.connection
-49: table_names.each do |table|
-50: connection.execute "DELETE FROM #{table}"
-51: end
-52: table_names
-53: end
-
-
-
-
-
-
-
-
-
-
-
-
[Source]
-
-
-
-24: def load_fixtures fixtures_param
-25: available = nil
-26: fixtures = fixtures_param.split(/\s*,\s*/).collect do |f|
-27: fixture_set = File.dirname f
-28: fixture_set = '' if fixture_set == '.'
-29: fixture = File.basename f
-30: if fixture == 'all'
-31: available ||= available_fixtures
-32: available[fixture_set]
-33: else
-34: f
-35: end
-36: end
-37: fixtures.flatten!
-38: fixtures.reject! {|f| f.blank? }
-39:
-40: if fixtures.any?
-41: Fixtures.create_fixtures fixtures_path, fixtures
-42: end
-43: fixtures
-44: end
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/PartialsSupport.html b/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/PartialsSupport.html
deleted file mode 100644
index 0d432d67..00000000
--- a/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/PartialsSupport.html
+++ /dev/null
@@ -1,195 +0,0 @@
-
-
-
-
-
- Module: SeleniumOnRails::PartialsSupport
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Provides partials support to test cases so they can include other partial
-test cases.
-
-
-The partial‘s commands are returned as html table rows.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Public Instance methods
-
-
-
-
-
-
-
-
-Extracts the commands from a partial. The partial must contain a html table
-and the first row is ignored since it cannot contain a command.
-
-
[Source]
-
-
-
-19: def extract_commands_from_partial partial
-20: partial = partial.match(/.*<table>.*?<tr>.*?<\/tr>(.*?)<\/table>/im)[1]
-21: raise "Partial '#{name}' doesn't contain any table" unless partial
-22: partial
-23: end
-
-
-
-
-
-
-
-
-
-
-
-
-Overrides where the partial is searched for, and returns only the command
-table rows.
-
-
[Source]
-
-
-
- 9: def render_partial partial_path = default_template_name, object = nil, local_assigns = nil, status = nil
-10: pattern = partial_pattern partial_path
-11: filename = Dir[pattern].first
-12: raise "Partial '#{partial_path}' cannot be found! (Looking for file: '#{pattern}')" unless filename
-13: partial = render :file => filename, :use_full_path => false, :locals => local_assigns
-14: extract_commands_from_partial partial
-15: end
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/Paths.html b/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/Paths.html
deleted file mode 100644
index 4ee3c542..00000000
--- a/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/Paths.html
+++ /dev/null
@@ -1,295 +0,0 @@
-
-
-
-
-
- Module: SeleniumOnRails::Paths
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Public Instance methods
-
-
-
-
-
-
-
-
[Source]
-
-
-
-25: def fixtures_path
-26: File.expand_path File.join(RAILS_ROOT, 'test/fixtures')
-27: end
-
-
-
-
-
-
-
-
-
-
-
-
-Returns the path to the layout template. The path is relative in relation
-to the app/views/ directory since Rails doesn‘t support absolute
-paths to layout templates.
-
-
[Source]
-
-
-
-19: def layout_path
-20: rails_root = Pathname.new File.expand_path(File.join(RAILS_ROOT, 'app/views'))
-21: view_path = Pathname.new view_path('layout')
-22: view_path.relative_path_from(rails_root).to_s
-23: end
-
-
-
-
-
-
-
-
-
-
-
-
[Source]
-
-
-
-29: def log_path log_file
-30: File.expand_path(File.dirname(__FILE__) + '/../../log/' + File.basename(log_file))
-31: end
-
-
-
-
-
-
-
-
-
-
-
-
[Source]
-
-
-
-3: def selenium_path
-4: @@selenium_path ||= find_selenium_path
-5: @@selenium_path
-6: end
-
-
-
-
-
-
-
-
-
-
-
-
[Source]
-
-
-
- 8: def selenium_tests_path
- 9: File.expand_path(File.join(RAILS_ROOT, 'test/selenium'))
-10: end
-
-
-
-
-
-
-
-
-
-
-
-
[Source]
-
-
-
-33: def skip_file? file
-34: file.split('/').each do |f|
-35: return true if f.upcase == 'CVS' or f.starts_with?('.') or f.ends_with?('~') or f.starts_with?('_')
-36: end
-37: false
-38: end
-
-
-
-
-
-
-
-
-
-
-
-
[Source]
-
-
-
-12: def view_path view
-13: File.expand_path(File.dirname(__FILE__) + '/../views/' + view)
-14: end
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/RSelenese.html b/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/RSelenese.html
deleted file mode 100644
index b57e9c23..00000000
--- a/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/RSelenese.html
+++ /dev/null
@@ -1,219 +0,0 @@
-
-
-
-
-
- Class: SeleniumOnRails::RSelenese
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Renders Selenium test templates in a fashion analogous to rxml and
-rjs templates.
-
-
- setup
- open :controller => 'customer', :action => 'list'
- assert_title 'Customers'
-
-
-See SeleniumOnRails::TestBuilder for a list
-of available commands.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Public Class methods
-
-
-
-
-
-
-
-
-Create a new RSelenese renderer bound to view.
-
-
[Source]
-
-
-
-17: def initialize view
-18: super view
-19: @view = view
-20: end
-
-
-
-
-
-
Public Instance methods
-
-
-
-
-
-
-
-
-Render template using local_assigns.
-
-
[Source]
-
-
-
-23: def render template, local_assigns
-24: title = (@view.assigns['page_title'] or local_assigns['page_title'])
-25: table(title) do
-26: test = self
-27:
-28: assign_locals_code = ''
-29: local_assigns.each_key {|key| assign_locals_code << "#{key} = local_assigns[#{key.inspect}];"}
-30:
-31: eval assign_locals_code + "\n" + template
-32: end
-33: end
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/Renderer.html b/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/Renderer.html
deleted file mode 100644
index ca8e1612..00000000
--- a/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/Renderer.html
+++ /dev/null
@@ -1,156 +0,0 @@
-
-
-
-
-
- Module: SeleniumOnRails::Renderer
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Public Instance methods
-
-
-
-
-
-
-
-
[Source]
-
-
-
- 5: def render_test_case filename
- 6: @template.extend SeleniumOnRails::PartialsSupport
- 7: @page_title = test_case_name filename
- 8: output = render_to_string :file => filename
- 9: layout = (output =~ /<html>/i ? false : layout_path)
-10: render :text => output, :layout => layout
-11:
-12: headers['Cache-control'] = 'no-cache'
-13: headers['Pragma'] = 'no-cache'
-14: headers['Expires'] = '-1'
-15: end
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/Selenese.html b/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/Selenese.html
deleted file mode 100644
index ba3c1648..00000000
--- a/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/Selenese.html
+++ /dev/null
@@ -1,179 +0,0 @@
-
-
-
-
-
- Class: SeleniumOnRails::Selenese
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Public Class methods
-
-
-
-
-
-
-
-
[Source]
-
-
-
-7: def initialize view
-8: @view = view
-9: end
-
-
-
-
-
-
Public Instance methods
-
-
-
-
-
-
-
-
[Source]
-
-
-
-11: def render template, local_assigns
-12: name = (@view.assigns['page_title'] or local_assigns['page_title'])
-13: lines = template.strip.split "\n"
-14: html = ''
-15: html << extract_comments(lines)
-16: html << extract_commands(lines, name)
-17: html << extract_comments(lines)
-18: raise 'You cannot have comments in the middle of commands!' if next_line lines, :any
-19: html
-20: end
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/SuiteRenderer.html b/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/SuiteRenderer.html
deleted file mode 100644
index a2d00bad..00000000
--- a/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/SuiteRenderer.html
+++ /dev/null
@@ -1,223 +0,0 @@
-
-
-
-
-
- Module: SeleniumOnRails::SuiteRenderer
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Public Instance methods
-
-
-
-
-
-
-
-
[Source]
-
-
-
-24: def link_to_test_case suite_name, filename
-25: name = suite_name + test_case_name(filename)
-26: link_to name, :action => :test_file, :testname => path_to_relative_url(filename).sub(/^\//,'')
-27: end
-
-
-
-
-
-
-
-
-
-
-
-
[Source]
-
-
-
-18: def test_cases path
-19: tests = []
-20: visit_all_tests path, '', nil, Proc.new {|n, p| tests << [n,p]}
-21: tests
-22: end
-
-
-
-
-
-
-
-
-
-
-
-
[Source]
-
-
-
-2: def test_suite_name path
-3: return 'All test cases' if [nil, '/'].include? path_to_relative_url(path)
-4: File.split(path)[-1].humanize
-5: end
-
-
-
-
-
-
-
-
-
-
-
-
[Source]
-
-
-
- 7: def test_suites path
- 8: suites = []
- 9:
-10: parent_path = File.join(File.split(path).slice(0..-2))
-11: parent_path = path_to_relative_url parent_path
-12: suites << ['..', parent_path] unless parent_path.nil?
-13:
-14: visit_all_tests path, '', Proc.new {|n, p| suites << [n,path_to_relative_url(p)]}, nil
-15: suites
-16: end
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/TestBuilder.html b/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/TestBuilder.html
deleted file mode 100644
index 7f2aeb6e..00000000
--- a/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/TestBuilder.html
+++ /dev/null
@@ -1,441 +0,0 @@
-
-
-
-
-
- Class: SeleniumOnRails::TestBuilder
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Public Class methods
-
-
-
-
-
-
-
-
-Create a new TestBuilder for view.
-
-
[Source]
-
-
-
-47: def initialize view
-48: @view = view
-49: @output = ''
-50: @xml = Builder::XmlMarkup.new :indent => 2, :target => @output
-51: end
-
-
-
-
-
-
-
-
-
-
-
-
-Convert str to a Selenium command name.
-
-
[Source]
-
-
-
-36: def self.selenize str
-37: str.camelize.gsub(/^[A-Z]/) {|s| s.downcase }
-38: end
-
-
-
-
-
-
Public Instance methods
-
-
-
-
-
-
-
-
-Add a new test command using cmd,
-target and value.
-
-
[Source]
-
-
-
-62: def command cmd, target=nil, value=nil
-63: @xml.tr do
-64: _tdata cmd
-65: _tdata target
-66: _tdata value
-67: end
-68: end
-
-
-
-
-
-
-
-
-
-
-
-
-Same as command but add
-AndWait to the name of cmd.
-
-
[Source]
-
-
-
-73: def command_and_wait cmd, target=nil, value=nil
-74: command_verbatim cmd.to_s + 'AndWait', target, value
-75: end
-
-
-
-
-
-
-
-
-
- command_verbatim(cmd, target=nil, value=nil)
-
-
-
-
-
-
-
-
-
-
-
-
-Prepends pattern with ‘exact:’ if it would be
-considered containing string-match pattern otherwise.
-
-
[Source]
-
-
-
-42: def exactize pattern
-43: pattern.include?(':') ? "exact:#{pattern}" : pattern
-44: end
-
-
-
-
-
-
-
-
-
-
-
-
-Re routes commands in the provided block to command_and_wait instead of command.
-
-
[Source]
-
-
-
-79: def make_command_waiting
-80: self.class.send :alias_method, :command, :command_and_wait
-81: yield
-82: self.class.send :alias_method, :command, :command_verbatim
-83: end
-
-
-
-
-
-
-
-
-
-
-
-
-Add a new table of tests, and return the HTML.
-
-
[Source]
-
-
-
-54: def table title
-55: @xml.table do
-56: @xml.tr do @xml.th(title, :colspan => 3) end
-57: yield self
-58: end
-59: end
-
-
-
-
-
-
Protected Instance methods
-
-
-
-
-
-
-
-
-If arg is an array formats arg to a textual
-representation. Otherwise return unchanged.
-
-
[Source]
-
-
-
- 95: def collection_arg arg
- 96: if arg.is_a? Array
- 97: arg.collect {|e| e.gsub(/[\\,]/) {|s| "\\#{s}" } }.join(',')
- 98: else
- 99: arg
-100: end
-101: end
-
-
-
-
-
-
-
-
-
-
-
-
-If url is a string, return unchanged. Otherwise, pass it to
-ActionView#UrlHelper#url_for.
-
-
[Source]
-
-
-
-89: def url_arg url
-90: if url.instance_of?(String) then url else exactize(@view.url_for(url)) end
-91: end
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/TestBuilderAccessors.html b/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/TestBuilderAccessors.html
deleted file mode 100644
index 16c6c020..00000000
--- a/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/TestBuilderAccessors.html
+++ /dev/null
@@ -1,3098 +0,0 @@
-
-
-
-
-
- Module: SeleniumOnRails::TestBuilderAccessors
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-The accessors available for SeleniumOnRails::TestBuilder tests.
-
-
-For each store_foo there‘s assert_foo,
-assert_not_foo, verify_foo, verify_not_foo,
-wait_for_foo, wait_for_not_foo.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Public Instance methods
-
-
-
-
-
-
-
-
-Gets the absolute URL of the current page.
-
-
-Related Assertions, automatically generated:
-
-
-- assert_absolute_location(pattern)
-
-
-- assert_not_absolute_location(pattern)
-
-
-- verify_absolute_location_present(pattern)
-
-
-- verify_not_absolute_location(pattern)
-
-
-- wait_for_absolute_location(pattern)
-
-
-- wait_for_not_absolute_location(pattern)
-
-
-
-
[Source]
-
-
-
-246: def store_absolute_location variable_name
-247: command 'storeAbsoluteLocation', variable_name
-248: end
-
-
-
-
-
-
-
-
-
-
-
-
-Retrieves the message of a JavaScript alert generated during the previous
-action, or fail if there were no alerts.
-
-
-Getting an alert has the same effect as manually clicking OK. If an alert
-is generated but you do not get/verify it, the next Selenium action will
-fail.
-
-
-NOTE: under Selenium, JavaScript alerts will NOT pop up a visible alert
-dialog.
-
-
-NOTE: Selenium does NOT support JavaScript alerts that are generated in a
-page‘s onload() event handler. In this case a visible dialog
-WILL be generated and Selenium will hang until someone manually clicks OK.
-
-
-Related Assertions, automatically generated:
-
-
-- assert_alert(pattern)
-
-
-- assert_not_alert(pattern)
-
-
-- verify_alert_present(pattern)
-
-
-- verify_not_alert(pattern)
-
-
-- wait_for_alert(pattern)
-
-
-- wait_for_not_alert(pattern)
-
-
-
-
[Source]
-
-
-
-183: def store_alert variable_name
-184: command 'storeAlert', variable_name
-185: end
-
-
-
-
-
-
-
-
-
-
-
-
-Has an alert occurred?
-
-
-Related Assertions, automatically generated:
-
-
-- assert_alert_present
-
-
-- assert_alert_not_present
-
-
-- verify_alert_present
-
-
-- verify_alert_not_present
-
-
-- wait_for_alert_present
-
-
-- wait_for_alert_not_present
-
-
-
-
[Source]
-
-
-
-89: def store_alert_present variable_name
-90: command 'storeAlertPresent', variable_name
-91: end
-
-
-
-
-
-
-
-
-
-
-
-
-Returns the IDs of all buttons on the page.
-
-
-If a given button has no ID, it will appear as "" in this array.
-
-
-The pattern for the automatically generated assertions can either
-take an array or a pattern.
-
-
- assert_all_buttons ['but1', 'but2']
- assert_all_buttons 'but?,but?*'
-
-
-Related Assertions, automatically generated:
-
-
-- assert_all_buttons(pattern)
-
-
-- assert_not_all_buttons(pattern)
-
-
-- verify_all_buttons(pattern)
-
-
-- verify_not_all_buttons(pattern)
-
-
-- wait_for_all_buttons(pattern)
-
-
-- wait_for_not_all_buttons(pattern)
-
-
-
-
[Source]
-
-
-
-754: def store_all_buttons variable_name
-755: command 'storeAllButtons', variable_name
-756: end
-
-
-
-
-
-
-
-
-
-
-
-
-Returns the IDs of all input fields on the page.
-
-
-If a given field has no ID, it will appear as "" in this array.
-
-
-The pattern for the automatically generated assertions can either
-take an array or a pattern.
-
-
- assert_all_fields ['field1', 'field2']
- assert_all_fields 'field?,field?*'
-
-
-Related Assertions, automatically generated:
-
-
-- assert_all_fields(pattern)
-
-
-- assert_not_all_fields(pattern)
-
-
-- verify_all_fields(pattern)
-
-
-- verify_not_all_fields(pattern)
-
-
-- wait_for_all_fields(pattern)
-
-
-- wait_for_not_all_fields(pattern)
-
-
-
-
[Source]
-
-
-
-794: def store_all_fields variable_name
-795: command 'storeAllFields', variable_name
-796: end
-
-
-
-
-
-
-
-
-
-
-
-
-Returns the IDs of all links on the page.
-
-
-If a given link has no ID, it will appear as "" in this array.
-
-
-The pattern for the automatically generated assertions can either
-take an array or a pattern.
-
-
- assert_all_links ['link1', 'link2']
- assert_all_links 'link?,link?*'
-
-
-Related Assertions, automatically generated:
-
-
-- assert_all_links(pattern)
-
-
-- assert_not_all_links(pattern)
-
-
-- verify_all_links(pattern)
-
-
-- verify_not_all_links(pattern)
-
-
-- wait_for_all_links(pattern)
-
-
-- wait_for_not_all_links(pattern)
-
-
-
-
[Source]
-
-
-
-774: def store_all_links variable_name
-775: command 'storeAllLinks', variable_name
-776: end
-
-
-
-
-
-
-
-
-
-
-
-
-Returns the IDs of all windows that the browser knows about.
-
-
-Related Assertions, automatically generated:
-
-
-- assertAllWindowIds(pattern)
-
-
-- assertNotAllWindowIds(pattern)
-
-
-- verifyAllWindowIds(pattern)
-
-
-- verifyNotAllWindowIds(pattern)
-
-
-- waitForAllWindowIds(pattern)
-
-
-- waitForNotAllWindowIds(pattern)
-
-
-
-
[Source]
-
-
-
-50: def store_all_window_ids variable_name
-51: command 'storeAllWindowIds', variable_name
-52: end
-
-
-
-
-
-
-
-
-
-
-
-
-Returns the names of all windows that the browser knows about.
-
-
-Related Assertions, automatically generated:
-
-
-- assertAllWindowNames(pattern)
-
-
-- assertNotAllWindowNames(pattern)
-
-
-- verifyAllWindowNames(pattern)
-
-
-- verifyNotAllWindowNames(pattern)
-
-
-- waitForAllWindowNames(pattern)
-
-
-- waitForNotAllWindowNames(pattern)
-
-
-
-
[Source]
-
-
-
-63: def store_all_window_names variable_name
-64: command 'storeAllWindowNames', variable_name
-65: end
-
-
-
-
-
-
-
-
-
-
-
-
-Returns the titles of all windows that the browser knows about.
-
-
-Related Assertions, automatically generated:
-
-
-- assertAllWindowTitles(pattern)
-
-
-- assertNotAllWindowTitles(pattern)
-
-
-- verifyAllWindowTitles(pattern)
-
-
-- verifyNotAllWindowTitles(pattern)
-
-
-- waitForAllWindowTitles(pattern)
-
-
-- waitForNotAllWindowTitles(pattern)
-
-
-
-
[Source]
-
-
-
-76: def store_all_window_titles variable_name
-77: command 'storeAllWindowTitles', variable_name
-78: end
-
-
-
-
-
-
-
-
-
-
-
-
-Gets the value of an element attribute.
-
-
-Related Assertions, automatically generated:
-
-
-- assert_attribute(locator, attribute_name, pattern)
-
-
-- assert_not_attribute(locator, attribute_name, pattern)
-
-
-- verify_attribute_present(locator, attribute_name, pattern)
-
-
-- verify_not_attribute(locator, attribute_name, pattern)
-
-
-- wait_for_attribute(locator, attribute_name, pattern)
-
-
-- wait_for_not_attribute(locator, attribute_name, pattern)
-
-
-
-
[Source]
-
-
-
-577: def store_attribute locator, attribute_name, variable_name
-578: command 'storeAttribute', "#{locator}@#{attribute_name}", variable_name
-579: end
-
-
-
-
-
-
-
-
-
-
-
-
-Returns every instance of some attribute from all known windows.
-
-
-Related Assertions, automatically generated:
-
-
-- assert_attribute_from_all_windows(attribute_name, pattern)
-
-
-- assert_not_attribute_from_all_windows(attribute_name, pattern)
-
-
-- verify_attribute_from_all_windows(attribute_name, pattern)
-
-
-- verify_not_attribute_from_all_windows(attribute_name, pattern)
-
-
-- wait_for_attribute_from_all_windows(attribute_name, pattern)
-
-
-- wait_for_not_attribute_from_all_windows(attribute_name, pattern)
-
-
-
-
[Source]
-
-
-
-102: def store_attribute_from_all_windows attribute_name, variable_name
-103: command 'storeAttributeFromAllWindows', attribute_name, variable_name
-104: end
-
-
-
-
-
-
-
-
-
-
-
-
-Gets the entire text of the page.
-
-
-Related Assertions, automatically generated:
-
-
-- assert_body_text(pattern)
-
-
-- assert_not_body_text(pattern)
-
-
-- verify_body_text_present(pattern)
-
-
-- verify_not_body_text(pattern)
-
-
-- wait_for_body_text(pattern)
-
-
-- wait_for_not_body_text(pattern)
-
-
-
-
[Source]
-
-
-
-300: def store_body_text variable_name
-301: command 'storeBodyText', variable_name
-302: end
-
-
-
-
-
-
-
-
-
-
-
-
-Gets whether a toggle-button (checkbox/radio) is checked. Fails if the
-specified element doesn‘t exist or isn‘t a toggle-button.
-
-
-Related Assertions, automatically generated:
-
-
-- assert_checked(locator)
-
-
-- assert_not_checked(locator)
-
-
-- verify_checked_present(locator)
-
-
-- verify_not_checked(locator)
-
-
-- wait_for_checked(locator)
-
-
-- wait_for_not_checked(locator)
-
-
-
-
[Source]
-
-
-
-370: def store_checked locator, variable_name
-371: command 'storeChecked', locator, variable_name
-372: end
-
-
-
-
-
-
-
-
-
-
-
-
-Retrieves the message of a JavaScript confirmation dialog generated during
-the previous action.
-
-
-By default, the confirm function will return true, having the same
-effect as manually clicking OK. This can be changed by prior execution of
-the choose_cancel_on_next_confirmation command. If a confirmation
-is generated but you do not get/verify it, the next Selenium action will
-fail.
-
-
-NOTE: under Selenium, JavaScript confirmations will NOT pop up a visible
-dialog.
-
-
-NOTE: Selenium does NOT support JavaScript confirmations that are generated
-in a page‘s onload() event handler. In this case a visible
-dialog WILL be generated and Selenium will hang until you manually click
-OK.
-
-
-Related Assertions, automatically generated:
-
-
-- assert_confirmation(pattern)
-
-
-- assert_not_confirmation(pattern)
-
-
-- verify_confirmation_present(pattern)
-
-
-- verify_not_confirmation(pattern)
-
-
-- wait_for_confirmation(pattern)
-
-
-- wait_for_not_confirmation(pattern)
-
-
-
-
[Source]
-
-
-
-209: def store_confirmation variable_name
-210: command 'storeConfirmation', variable_name
-211: end
-
-
-
-
-
-
-
-
-
-
-
-
-Has confirm() been called?
-
-
-Related Assertions, automatically generated:
-
-
-- assert_confirmation_present
-
-
-- assert_confirmation_not_present
-
-
-- verify_confirmation_present
-
-
-- verify_confirmation_not_present
-
-
-- wait_for_confirmation_present
-
-
-- wait_for_confirmation_not_present
-
-
-
-
[Source]
-
-
-
-128: def store_confirmation_present variable_name
-129: command 'storeConfirmationPresent', variable_name
-130: end
-
-
-
-
-
-
-
-
-
-
-
-
-Return all cookies of the current page under test.
-
-
-Related Assertions, automatically generated:
-
-
-- assert_cookie(pattern)
-
-
-- assert_not_cookie(pattern)
-
-
-- verify_cookie(pattern)
-
-
-- verify_not_cookie(pattern)
-
-
-- wait_for_cookie(pattern)
-
-
-- wait_for_not_cookie(pattern)
-
-
-
-
[Source]
-
-
-
-141: def store_cookie variable_name
-142: command 'storeCookie', variable_name
-143: end
-
-
-
-
-
-
-
-
-
-
-
-
-Retrieves the text cursor position in the given input element or textarea;
-beware, this may not work perfectly on all browsers.
-
-
-This method will fail if the specified element isn‘t an input element
-or textarea, or there is no cursor in the element.
-
-
-Related Assertions, automatically generated:
-
-
-- assert_cursor_position(locator, pattern)
-
-
-- assert_not_cursor_position(locator, pattern)
-
-
-- verify_cursor_position(locator, pattern)
-
-
-- verify_not_cursor_position(locator, pattern)
-
-
-- wait_for_cursor_position(locator, pattern)
-
-
-- wait_for_not_cursor_position(locator, pattern)
-
-
-
-
[Source]
-
-
-
-158: def store_cursor_position locator, variable_name
-159: command 'storeCursorPosition', locator, variable_name
-160: end
-
-
-
-
-
-
-
-
-
-
-
-
-Determines whether the specified input element is editable, i.e.
-hasn‘t been disabled. This method will fail if the specified element
-isn‘t an input element.
-
-
-Related Assertions, automatically generated:
-
-
-- assert_editable(locator)
-
-
-- assert_not_editable(locator)
-
-
-- verify_editable(locator)
-
-
-- verify_not_editable(locator)
-
-
-- wait_for_editable(locator)
-
-
-- wait_for_not_editable(locator)
-
-
-
-
[Source]
-
-
-
-734: def store_editable locator, variable_name
-735: command 'storeEditable', locator, variable_name
-736: end
-
-
-
-
-
-
-
-
-
-
-
-
-Retrieves the height of an element. This method will fail if the element is
-not present.
-
-
-Related Assertions, automatically generated:
-
-
-- assert_element_height(locator, pattern)
-
-
-- assert_not_element_height(locator, pattern)
-
-
-- verify_element_height(locator, pattern)
-
-
-- verify_not_element_height(locator, pattern)
-
-
-- wait_for_element_height(locator, pattern)
-
-
-- wait_for_not_element_height(locator, pattern)
-
-
-
-
[Source]
-
-
-
-650: def store_element_height locator, variable_name
-651: command 'storeElementHeight', locator, variable_name
-652: end
-
-
-
-
-
-
-
-
-
-
-
-
-Get the relative index of an element to its parent (starting from 0). The
-comment node and empty text node will be ignored.
-
-
-Related Assertions, automatically generated:
-
-
-- assert_element_index(locator, pattern)
-
-
-- assert_not_element_index(locator, pattern)
-
-
-- verify_element_index(locator, pattern)
-
-
-- verify_not_element_index(locator, pattern)
-
-
-- wait_for_element_index(locator, pattern)
-
-
-- wait_for_not_element_index(locator, pattern)
-
-
-
-
[Source]
-
-
-
-664: def store_element_index locator, variable_name
-665: command 'storeElementIndex', locator, variable_name
-666: end
-
-
-
-
-
-
-
-
-
-
-
-
-Retrieves the horizontal position of an element. This method will fail if
-the element is not present.
-
-
-Related Assertions, automatically generated:
-
-
-- assert_element_position_left(locator, pattern)
-
-
-- assert_not_element_position_left(locator, pattern)
-
-
-- verify_element_position_left(locator, pattern)
-
-
-- verify_not_element_position_left(locator, pattern)
-
-
-- wait_for_element_position_left(locator, pattern)
-
-
-- wait_for_not_element_position_left(locator, pattern)
-
-
-
-
[Source]
-
-
-
-692: def store_element_position_left locator, variable_name
-693: command 'storeElementPositionLeft', locator, variable_name
-694: end
-
-
-
-
-
-
-
-
-
-
-
-
-Retrieves the vertical position of an element. This method will fail if the
-element is not present.
-
-
-Related Assertions, automatically generated:
-
-
-- assert_element_position_top(locator, pattern)
-
-
-- assert_not_element_position_top(locator, pattern)
-
-
-- verify_element_position_top(locator, pattern)
-
-
-- verify_not_element_position_top(locator, pattern)
-
-
-- wait_for_element_position_top(locator, pattern)
-
-
-- wait_for_not_element_position_top(locator, pattern)
-
-
-
-
[Source]
-
-
-
-706: def store_element_position_top locator, variable_name
-707: command 'storeElementPositionTop', locator, variable_name
-708: end
-
-
-
-
-
-
-
-
-
-
-
-
-Verifies that the specified element is somewhere on the page.
-
-
-Related Assertions, automatically generated:
-
-
-- assert_element_present(locator)
-
-
-- assert_element_not_present(locator)
-
-
-- verify_element_present(locator)
-
-
-- verify_element_not_present(locator)
-
-
-- wait_for_element_present(locator)
-
-
-- wait_for_element_not_present(locator)
-
-
-
-
[Source]
-
-
-
-620: def store_element_present locator, variable_name
-621: command 'storeElementPresent', locator, variable_name
-622: end
-
-
-
-
-
-
-
-
-
-
-
-
-Retrieves the width of an element. This method will fail if the element is
-not present.
-
-
-Related Assertions, automatically generated:
-
-
-- assert_element_width(locator, pattern)
-
-
-- assert_not_element_width(locator, pattern)
-
-
-- verify_element_width(locator, pattern)
-
-
-- verify_not_element_width(locator, pattern)
-
-
-- wait_for_element_width(locator, pattern)
-
-
-- wait_for_not_element_width(locator, pattern)
-
-
-
-
[Source]
-
-
-
-678: def store_element_width locator, variable_name
-679: command 'storeElementWidth', locator, variable_name
-680: end
-
-
-
-
-
-
-
-
-
-
-
-
-Tell Selenium to expect an error on the next command execution.
-
-
-NOTE: store_error_on_next is
-currently not supported by Selenium Core and is only added to here as a
-shortcut for generating the related assertions.
-
-
-Related Assertions, automatically generated:
-
-
-- assert_error_on_next(message)
-
-
-- assert_not_error_on_next(message)
-
-
-- verify_error_on_next(message)
-
-
-- verify_not_error_on_next(message)
-
-
-- wait_for_error_on_next(message)
-
-
-- wait_for_not_error_on_next(message)
-
-
-
-
[Source]
-
-
-
-20: def store_error_on_next message
-21: raise 'Not supported in Selenium Core at the moment'
-22: end
-
-
-
-
-
-
-
-
-
-
-
-
-Gets the result of evaluating the specified JavaScript snippet. The snippet
-may have multiple lines, but only the result of the last line will be
-returned.
-
-
-Note that, by default, the snippet will run in the context of the
-"selenium" object itself, so this will refer to the
-Selenium object, and window will refer to the top-level runner
-test window, not the window of your application.
-
-
-If you need a reference to the window of your application, you can refer to
-this.browserbot.getCurrentWindow() and if you need to use a
-locator to refer to a single element in your application page, you can use
-this.page().findElement("foo") where
-"foo" is your locator.
-
-
-Related Assertions, automatically generated:
-
-
-- assert_eval(script, pattern)
-
-
-- assert_not_eval(script, pattern)
-
-
-- verify_eval_present(script, pattern)
-
-
-- verify_not_eval(script, pattern)
-
-
-- wait_for_eval(script, pattern)
-
-
-- wait_for_not_eval(script, pattern)
-
-
-
-
[Source]
-
-
-
-356: def store_eval script, variable_name
-357: command 'storeEval', script, variable_name
-358: end
-
-
-
-
-
-
-
-
-
-
-
-
-Returns the specified expression.
-
-
-This is useful because of JavaScript preprocessing.
-
-
-Related Assertions, automatically generated:
-
-
-- assert_expression(expression, pattern)
-
-
-- assert_not_expression(expression, pattern)
-
-
-- verify_expression(expression, pattern)
-
-
-- verify_not_expression(expression, pattern)
-
-
-- wait_for_expression(expression, pattern)
-
-
-- wait_for_not_expression(expression, pattern)
-
-
-
-
[Source]
-
-
-
-822: def store_expression expression, variable_name
-823: command 'storeExpression', expression, variable_name
-824: end
-
-
-
-
-
-
-
-
-
-
-
-
-Tell Selenium to expect a failure on the next command execution.
-
-
-NOTE: store_failure_on_next is
-currently not supported by Selenium Core and is only added to here as a
-shortcut for generating the related assertions.
-
-
-Related Assertions, automatically generated:
-
-
-- assert_failure_on_next(message)
-
-
-- assert_not_failure_on_next(message)
-
-
-- verify_failure_on_next(message)
-
-
-- verify_not_failure_on_next(message)
-
-
-- wait_for_failure_on_next(message)
-
-
-- wait_for_not_failure_on_next(message)
-
-
-
-
[Source]
-
-
-
-37: def store_failure_on_next message
-38: raise 'Not supported in Selenium Core at the moment'
-39: end
-
-
-
-
-
-
-
-
-
-
-
-
-Returns the entire HTML source between the opening and closing
-"html" tags.
-
-
-Related Assertions, automatically generated:
-
-
-- assert_html_source(pattern)
-
-
-- assert_not_html_source(pattern)
-
-
-- verify_html_source(pattern)
-
-
-- verify_not_html_source(pattern)
-
-
-- wait_for_html_source(pattern)
-
-
-- wait_for_not_html_source(pattern)
-
-
-
-
[Source]
-
-
-
-807: def store_html_source variable_name
-808: command 'storeHtmlSource', variable_name
-809: end
-
-
-
-
-
-
-
-
-
-
-
-
-Verify the location of the current page ends with the expected location. If
-an URL querystring is provided, this is checked as well.
-
-
-Related Assertions, automatically generated:
-
-
-- assert_location(pattern)
-
-
-- assert_not_location(pattern)
-
-
-- verify_location_present(pattern)
-
-
-- verify_not_location(pattern)
-
-
-- wait_for_location(pattern)
-
-
-- wait_for_not_location(pattern)
-
-
-
-
[Source]
-
-
-
-260: def store_location expected_location, variable_name
-261: command 'storeLocation', expected_location, variable_name
-262: end
-
-
-
-
-
-
-
-
-
-
-
-
-Return the contents of the log.
-
-
-Related Assertions, automatically generated:
-
-
-- assert_log_messages(pattern)
-
-
-- assert_not_log_messages(pattern)
-
-
-- verify_log_messages(pattern)
-
-
-- verify_not_log_messages(pattern)
-
-
-- wait_for_log_messages(pattern)
-
-
-- wait_for_not_log_messages(pattern)
-
-
-
-
[Source]
-
-
-
-719: def store_log_messages variable_name
-720: command 'storeLogMessages', variable_name
-721: end
-
-
-
-
-
-
-
-
-
-
-
-
-Returns the number of pixels between "mousemove" events during
-drag_and_drop commands (default=10).
-
-
-Related Assertions, automatically generated:
-
-
-- assert_mouse_speed(pattern)
-
-
-- assert_not_mouse_speed(pattern)
-
-
-- verify_mouse_speed(pattern)
-
-
-- verify_not_mouse_speed(pattern)
-
-
-- wait_for_mouse_speed(pattern)
-
-
-- wait_for_not_mouse_speed(pattern)
-
-
-
-
[Source]
-
-
-
-274: def store_mouse_speed variable_name
-275: command 'storeMouseSpeed', variable_name
-276: end
-
-
-
-
-
-
-
-
-
-
-
-
-Check if these two elements have same parent and are ordered. Two same
-elements will not be considered ordered.
-
-
-NOTE: store_ordered is
-currently not supported by Selenium Core.
-
-
-Related Assertions, automatically generated:
-
-
-- assert_ordered(locator_1, locator_2)
-
-
-- assert_not_ordered(locator_1, locator_2)
-
-
-- verify_ordered(locator_1, locator_2)
-
-
-- verify_not_ordered(locator_1, locator_2)
-
-
-- wait_for_ordered(locator_1, locator_2)
-
-
-- wait_for_not_ordered(locator_1, locator_2)
-
-
-
-
[Source]
-
-
-
-593: def store_ordered locator_1, locator_2, variable_name
-594: raise 'Not supported in Selenium Core at the moment'
-595: end
-
-
-
-
-
-
-
-
-
-
-
-
-Retrieves the message of a JavaScript question prompt dialog generated
-during the previous action.
-
-
-Successful handling of the prompt requires prior execution of the
-answer_on_next_prompt command. If a prompt is generated but you do
-not get/verify it, the next Selenium action will fail.
-
-
-NOTE: under Selenium, JavaScript prompts will NOT pop up a visible dialog.
-
-
-NOTE: Selenium does NOT support JavaScript prompts that are generated in a
-page‘s onload() event handler. In this case a visible dialog
-WILL be generated and Selenium will hang until someone manually clicks OK.
-
-
-Related Assertions, automatically generated:
-
-
-- assert_prompt(pattern)
-
-
-- assert_not_prompt(pattern)
-
-
-- verify_prompt_present(pattern)
-
-
-- verify_not_prompt(pattern)
-
-
-- wait_for_prompt(pattern)
-
-
-- wait_for_not_prompt(pattern)
-
-
-
-
[Source]
-
-
-
-233: def store_prompt variable_name
-234: command 'storePrompt', variable_name
-235: end
-
-
-
-
-
-
-
-
-
-
-
-
-Has a prompt occurred?
-
-
-Related Assertions, automatically generated:
-
-
-- assert_prompt_present
-
-
-- assert_prompt_not_present
-
-
-- verify_prompt_present
-
-
-- verify_prompt_not_present
-
-
-- wait_for_prompt_present
-
-
-- wait_for_prompt_not_present
-
-
-
-
[Source]
-
-
-
-115: def store_prompt_present variable_name
-116: command 'storePromptPresent', variable_name
-117: end
-
-
-
-
-
-
-
-
-
-
-
-
-Gets all option labels in the specified select drop-down.
-
-
-The pattern for the automatically generated assertions can either
-take an array or a pattern.
-
-
- assert_select_options 'fruits', ['apple', 'pear']
- assert_select_options 'fruits', 'a*,p*'
-
-
-Related Assertions, automatically generated:
-
-
-- assert_select_options(locator, pattern)
-
-
-- assert_not_select_options(locator, pattern)
-
-
-- verify_select_options_present(locator, pattern)
-
-
-- verify_not_select_options(locator, pattern)
-
-
-- wait_for_select_options(locator, pattern)
-
-
-- wait_for_not_select_options(locator, pattern)
-
-
-
-
[Source]
-
-
-
-564: def store_select_options locator, variable_name
-565: command 'storeSelectOptions', locator, variable_name
-566: end
-
-
-
-
-
-
-
-
-
-
-
-
-Verifies that the selected option of a drop-down satisfies the
-option_locator.
-
-
-option_locator is typically just an option label (e.g. "John
-Smith").
-
-
-See the select command for more information about option locators.
-
-
-NOTE: store_selected is
-currently not supported by Selenium Core.
-
-
-Related Assertions, automatically generated:
-
-
-- assert_selected(locator, option_locator)
-
-
-- assert_not_selected(locator, option_locator)
-
-
-- verify_selected_present(locator, option_locator)
-
-
-- verify_not_selected(locator, option_locator)
-
-
-- wait_for_selected(locator, option_locator)
-
-
-- wait_for_not_selected(locator, option_locator)
-
-
-
-
[Source]
-
-
-
-403: def store_selected locator, option_locator, variable_name
-404: raise 'Not supported in Selenium Core at the moment'
-405: end
-
-
-
-
-
-
-
-
-
-
-
-
-Gets option element ID for selected option in the specified select element.
-
-
-Related Assertions, automatically generated:
-
-
-- assert_selected_id(select_locator, pattern)
-
-
-- assert_not_selected_id(select_locator, pattern)
-
-
-- verify_selected_id(select_locator, pattern)
-
-
-- verify_not_selected_id(select_locator, pattern)
-
-
-- wait_for_selected_id(select_locator, pattern)
-
-
-- wait_for_not_selected_id(select_locator, pattern)
-
-
-
-
[Source]
-
-
-
-416: def store_selected_id select_locator, variable_name
-417: command 'storeSelectedId', select_locator, variable_name
-418: end
-
-
-
-
-
-
-
-
-
-
-
-
-Gets all option element IDs for selected options in the specified select or
-multi-select element.
-
-
-Related Assertions, automatically generated:
-
-
-- assert_selected_ids(select_locator, pattern)
-
-
-- assert_not_selected_ids(select_locator, pattern)
-
-
-- verify_selected_ids(select_locator, pattern)
-
-
-- verify_not_selected_ids(select_locator, pattern)
-
-
-- wait_for_selected_ids(select_locator, pattern)
-
-
-- wait_for_not_selected_ids(select_locator, pattern)
-
-
-
-
[Source]
-
-
-
-430: def store_selected_ids select_locator, variable_name
-431: command 'storeSelectedIds', select_locator, variable_name
-432: end
-
-
-
-
-
-
-
-
-
-
-
-
-Gets option index (option number, starting at 0) for selected option in the
-specified select element.
-
-
-Related Assertions, automatically generated:
-
-
-- assert_selected_index(select_locator, pattern)
-
-
-- assert_not_selected_index(select_locator, pattern)
-
-
-- verify_selected_index(select_locator, pattern)
-
-
-- verify_not_selected_index(select_locator, pattern)
-
-
-- wait_for_selected_index(select_locator, pattern)
-
-
-- wait_for_not_selected_index(select_locator, pattern)
-
-
-
-
[Source]
-
-
-
-444: def store_selected_index select_locator, variable_name
-445: command 'storeSelectedIndex', select_locator, variable_name
-446: end
-
-
-
-
-
-
-
-
-
-
-
-
-Gets all option indexes (option number, starting at 0) for selected options
-in the specified select or multi-select element.
-
-
-Related Assertions, automatically generated:
-
-
-- assert_selected_indexes(select_locator, pattern)
-
-
-- assert_not_selected_indexes(select_locator, pattern)
-
-
-- verify_selected_indexes(select_locator, pattern)
-
-
-- verify_not_selected_indexes(select_locator, pattern)
-
-
-- wait_for_selected_indexes(select_locator, pattern)
-
-
-- wait_for_not_selected_indexes(select_locator, pattern)
-
-
-
-
[Source]
-
-
-
-458: def store_selected_indexes select_locator, variable_name
-459: command 'storeSelectedIndexes', select_locator, variable_name
-460: end
-
-
-
-
-
-
-
-
-
-
-
-
-Gets option label (visible text) for selected option in the specified
-select element.
-
-
-Related Assertions, automatically generated:
-
-
-- assert_selected_label(select_locator, pattern)
-
-
-- assert_not_selected_label(select_locator, pattern)
-
-
-- verify_selected_label(select_locator, pattern)
-
-
-- verify_not_selected_label(select_locator, pattern)
-
-
-- wait_for_selected_label(select_locator, pattern)
-
-
-- wait_for_not_selected_label(select_locator, pattern)
-
-
-
-
[Source]
-
-
-
-472: def store_selected_label select_locator, variable_name
-473: command 'storeSelectedLabel', select_locator, variable_name
-474: end
-
-
-
-
-
-
-
-
-
-
-
-
-Gets all option labels (visible text) for selected options in the specified
-select or multi-select element.
-
-
-Related Assertions, automatically generated:
-
-
-- assert_selected_labels(select_locator, pattern)
-
-
-- assert_not_selected_labels(select_locator, pattern)
-
-
-- verify_selected_labels(select_locator, pattern)
-
-
-- verify_not_selected_labels(select_locator, pattern)
-
-
-- wait_for_selected_labels(select_locator, pattern)
-
-
-- wait_for_not_selected_labels(select_locator, pattern)
-
-
-
-
[Source]
-
-
-
-486: def store_selected_labels select_locator, variable_name
-487: command 'storeSelectedLabels', select_locator, variable_name
-488: end
-
-
-
-
-
-
-
-
-
-
-
-
-Gets all option labels for selected options in the specified select or
-multi-select element.
-
-
-The pattern for the automatically generated assertions can either
-take an array or a pattern.
-
-
- assert_selected_options 'fruits', ['apple', 'pear']
- assert_selected_options 'fruits', 'a*,p*'
-
-
-Related Assertions, automatically generated:
-
-
-- assert_selected_options(locator, pattern)
-
-
-- assert_not_selected_options(locator, pattern)
-
-
-- verify_selected_options_present(locator, pattern)
-
-
-- verify_not_selected_options(locator, pattern)
-
-
-- wait_for_selected_options(locator, pattern)
-
-
-- wait_for_not_selected_options(locator, pattern)
-
-
-
-
[Source]
-
-
-
-546: def store_selected_options locator, variable_name
-547: command 'storeSelectedOptions', locator, variable_name
-548: end
-
-
-
-
-
-
-
-
-
-
-
-
-Gets option value (value attribute) for selected option in the specified
-select element.
-
-
-Related Assertions, automatically generated:
-
-
-- assert_selected_value(select_locator, pattern)
-
-
-- assert_not_selected_value(select_locator, pattern)
-
-
-- verify_selected_value(select_locator, pattern)
-
-
-- verify_not_selected_value(select_locator, pattern)
-
-
-- wait_for_selected_value(select_locator, pattern)
-
-
-- wait_for_not_selected_value(select_locator, pattern)
-
-
-
-
[Source]
-
-
-
-500: def store_selected_value select_locator, variable_name
-501: command 'storeSelectedValue', select_locator, variable_name
-502: end
-
-
-
-
-
-
-
-
-
-
-
-
-Gets all option values (value attribute) for selected options in the
-specified select or multi-select element.
-
-
-Related Assertions, automatically generated:
-
-
-- assert_selected_values(select_locator, pattern)
-
-
-- assert_not_selected_values(select_locator, pattern)
-
-
-- verify_selected_values(select_locator, pattern)
-
-
-- verify_not_selected_values(select_locator, pattern)
-
-
-- wait_for_selected_values(select_locator, pattern)
-
-
-- wait_for_not_selected_values(select_locator, pattern)
-
-
-
-
[Source]
-
-
-
-514: def store_selected_values select_locator, variable_name
-515: command 'storeSelectedValues', select_locator, variable_name
-516: end
-
-
-
-
-
-
-
-
-
-
-
-
-Determines whether some option in a drop-down menu is selected.
-
-
-Related Assertions, automatically generated:
-
-
-- assert_something_selected(select_locator)
-
-
-- assert_not_something_selected(select_locator)
-
-
-- verify_something_selected(select_locator)
-
-
-- verify_not_something_selected(select_locator)
-
-
-- wait_for_something_selected(select_locator)
-
-
-- wait_for_not_something_selected(select_locator)
-
-
-
-
[Source]
-
-
-
-527: def store_something_selected select_locator, variable_name
-528: command 'storeSomethingSelected', select_locator, variable_name
-529: end
-
-
-
-
-
-
-
-
-
-
-
-
-Gets the text from a cell of a table.
-
-
-Related Assertions, automatically generated:
-
-
-- assert_table(locator, row, column, pattern)
-
-
-- assert_not_table(locator, row, column, pattern)
-
-
-- verify_table_present(locator, row, column, pattern)
-
-
-- verify_not_table(locator, row, column, pattern)
-
-
-- wait_for_table(locator, row, column, pattern)
-
-
-- wait_for_not_table(locator, row, column, pattern)
-
-
-
-
[Source]
-
-
-
-383: def store_table locator, row, column, variable_name
-384: command 'storeTable', "#{locator}.#{row}.#{column}", variable_name
-385: end
-
-
-
-
-
-
-
-
-
-
-
-
-Gets the text of an element. This works for any element that contains text.
-This command uses either the textContent (Mozilla-like browsers)
-or the innerText (IE-like browsers) of the element, which is the
-rendered text shown to the user.
-
-
-Related Assertions, automatically generated:
-
-
-- assert_text(locator, pattern)
-
-
-- assert_not_text(locator, pattern)
-
-
-- verify_text_present(locator, pattern)
-
-
-- verify_not_text(locator, pattern)
-
-
-- wait_for_text(locator, pattern)
-
-
-- wait_for_not_text(locator, pattern)
-
-
-
-
[Source]
-
-
-
-331: def store_text locator, variable_name
-332: command 'storeText', locator, variable_name
-333: end
-
-
-
-
-
-
-
-
-
-
-
-
-Verifies that the specified text pattern appears somewhere on the rendered
-page shown to the user.
-
-
-Related Assertions, automatically generated:
-
-
-- assert_text_present(pattern)
-
-
-- assert_text_not_present(pattern)
-
-
-- verify_text_present(pattern)
-
-
-- verify_text_not_present(pattern)
-
-
-- wait_for_text_present(pattern)
-
-
-- wait_for_text_not_present(pattern)
-
-
-
-
[Source]
-
-
-
-607: def store_text_present pattern, variable_name
-608: command 'storeTextPresent', pattern, variable_name
-609: end
-
-
-
-
-
-
-
-
-
-
-
-
-Gets the title of the current page.
-
-
-Related Assertions, automatically generated:
-
-
-- assert_title(pattern)
-
-
-- assert_not_title(pattern)
-
-
-- verify_title_present(pattern)
-
-
-- verify_not_title(pattern)
-
-
-- wait_for_title(pattern)
-
-
-- wait_for_not_title(pattern)
-
-
-
-
[Source]
-
-
-
-287: def store_title variable_name
-288: command 'storeTitle', variable_name
-289: end
-
-
-
-
-
-
-
-
-
-
-
-
-Gets the (whitespace-trimmed) value of an input field (or anything else
-with a value parameter). For checkbox/radio elements, the value will be
-"on" or "off" depending on whether the element is
-checked or not.
-
-
-Related Assertions, automatically generated:
-
-
-- assert_value(locator, pattern)
-
-
-- assert_not_value(locator, pattern)
-
-
-- verify_value_present(locator, pattern)
-
-
-- verify_not_value(locator, pattern)
-
-
-- wait_for_value(locator, pattern)
-
-
-- wait_for_not_value(locator, pattern)
-
-
-
-
[Source]
-
-
-
-315: def store_value locator, variable_name
-316: command 'storeValue', locator, variable_name
-317: end
-
-
-
-
-
-
-
-
-
-
-
-
-Determines if the specified element is visible. An element can be rendered
-invisible by setting the CSS "visibility" property to
-"hidden", or the "display" property to
-"none", either for the element itself or one if its ancestors.
-This method will fail if the element is not present.
-
-
-Related Assertions, automatically generated:
-
-
-- assert_visible(locator)
-
-
-- assert_not_visible(locator)
-
-
-- verify_visible(locator)
-
-
-- verify_not_visible(locator)
-
-
-- wait_for_visible(locator)
-
-
-- wait_for_not_visible(locator)
-
-
-
-
[Source]
-
-
-
-636: def store_visible locator, variable_name
-637: command 'storeVisible', locator, variable_name
-638: end
-
-
-
-
-
-
-
-
-
-
-
-
-Determine whether current/locator identify the frame containing this
-running code.
-
-
-This is useful in proxy injection mode, where this code runs in every
-browser frame and window, and sometimes the selenium server needs to
-identify the "current" frame. In this case, when the test calls
-select_frame, this routine is called for each frame to figure out which one
-has been selected. The selected frame will return true, while all others
-will return false.
-
-
-NOTE: store_whether_this_frame_match_frame_expression
-is currently not supported by Selenium Core.
-
-
-Related Assertions, automatically generated:
-
-
-- assert_whether_this_frame_match_frame_expression(current_frame_string,
-target)
-
-
-- assert_not_whether_this_frame_match_frame_expression(current_frame_string,
-target)
-
-
-- verify_whether_this_frame_match_frame_expression(current_frame_string,
-target)
-
-
-- verify_not_whether_this_frame_match_frame_expression(current_frame_string,
-target)
-
-
-- wait_for_whether_this_frame_match_frame_expression(current_frame_string,
-target)
-
-
-- wait_for_not_whether_this_frame_match_frame_expression(current_frame_string,
-target)
-
-
-
-
[Source]
-
-
-
-846: def store_whether_this_frame_match_frame_expression current_frame_string, target, variable_name
-847: raise 'Not supported in Selenium Core at the moment'
-848: end
-
-
-
-
-
-
-
-
-
-
-
-
-Determine whether current_window_string plus target identify the window
-containing this running code.
-
-
-This is useful in proxy injection mode, where this code runs in every
-browser frame and window, and sometimes the selenium server needs to
-identify the "current" window. In this case, when the test calls
-select_window, this routine is called for each window to figure out which
-one has been selected. The selected window will return true, while all
-others will return false.
-
-
-NOTE: store_whether_this_window_match_window_expression
-is currently not supported by Selenium Core.
-
-
-Related Assertions, automatically generated:
-
-
-- assert_whether_this_window_match_window_expression(current_window_string,
-target)
-
-
-- assert_not_whether_this_window_match_window_expression(current_window_string,
-target)
-
-
-- verify_whether_this_window_match_window_expression(current_window_string,
-target)
-
-
-- verify_not_whether_this_window_match_window_expression(current_window_string,
-target)
-
-
-- wait_for_whether_this_window_match_window_expression(current_window_string,
-target)
-
-
-- wait_for_not_whether_this_window_match_window_expression(current_window_string,
-target)
-
-
-
-
[Source]
-
-
-
-869: def store_whether_this_window_match_window_expression current_window_string, target, variable_name
-870: raise 'Not supported in Selenium Core at the moment'
-871: end
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/TestBuilderActions.html b/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/TestBuilderActions.html
deleted file mode 100644
index b48104f2..00000000
--- a/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/TestBuilderActions.html
+++ /dev/null
@@ -1,2080 +0,0 @@
-
-
-
-
-
- Module: SeleniumOnRails::TestBuilderActions
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Public Instance methods
-
-
-
-
-
-
-
-
-Add a selection to the set of selected options in a multi-select element using an option
-locator.
-
-
-See the select
-command for more information about option locators.
-
-
[Source]
-
-
-
-148: def add_selection locator, option_locator
-149: command 'addSelection', locator, option_locator
-150: end
-
-
-
-
-
-
-
-
-
-
-
-
-Simulates the user pressing the alt key and hold it down until do_alt_up()
-is called or a new page is loaded.
-
-
[Source]
-
-
-
-221: def alt_key_down
-222: command 'altKeyDown'
-223: end
-
-
-
-
-
-
-
-
-
-
-
-
-Simulates the user releasing the alt key.
-
-
[Source]
-
-
-
-226: def alt_key_up
-227: command 'altKeyUp'
-228: end
-
-
-
-
-
-
-
-
-
-
-
-
-Instructs Selenium to return the specified answer string in response to the
-next JavaScript prompt (window.prompt()).
-
-
[Source]
-
-
-
-199: def answer_on_next_prompt answer
-200: command 'answerOnNextPrompt', answer
-201: end
-
-
-
-
-
-
-
-
-
-
-
-
-Halt the currently running test, and wait for the user to press the
-Continue button. This command is useful for debugging, but be careful when
-using it, because it will force automated tests to hang until a user
-intervenes manually.
-
-
-NOTE: break is a reserved word in Ruby, so we have to simulate
-Selenium core‘s break() with brake()
-
-
[Source]
-
-
-
-236: def brake
-237: command 'break'
-238: end
-
-
-
-
-
-
-
-
-
-
-
-
-Check a toggle-button (checkbox/radio).
-
-
[Source]
-
-
-
-108: def check locator
-109: command 'check', locator
-110: end
-
-
-
-
-
-
-
-
-
-
-
-
-By default, Selenium‘s overridden window.confirm() function
-will return true, as if the user had manually clicked OK. After
-running this command, the next call to confirm() will return
-false, as if the user had clicked Cancel.
-
-
[Source]
-
-
-
-193: def choose_cancel_on_next_confirmation
-194: command 'chooseCancelOnNextConfirmation'
-195: end
-
-
-
-
-
-
-
-
-
-
-
-
-Clicks on a link, button, checkbox or radio button. If the click action causes a new page
-to load (like a link usually does), call wait_for_page_to_load.
-
-
[Source]
-
-
-
-47: def click locator
-48: command 'click', locator
-49: end
-
-
-
-
-
-
-
-
-
-
-
-
-Clicks on a link, button, checkbox or radio button. If the click action causes a new page
-to load (like a link usually does), call wait_for_page_to_load.
-
-
[Source]
-
-
-
-53: def click_at locator, coord_string
-54: command 'clickAt', locator, coord_string
-55: end
-
-
-
-
-
-
-
-
-
-
-
-
-Simulates the user clicking the "close" button in the
-titlebar of a popup window or tab.
-
-
[Source]
-
-
-
-215: def close
-216: command 'close'
-217: end
-
-
-
-
-
-
-
-
-
-
-
-
-Simulates the user pressing the alt key and hold it down until
-do_control_up() is called or a new page is loaded.
-
-
[Source]
-
-
-
-242: def control_key_down
-243: command 'controlKeyDown'
-244: end
-
-
-
-
-
-
-
-
-
-
-
-
-Simulates the user releasing the control key.
-
-
[Source]
-
-
-
-247: def control_key_up
-248: command 'controlKeyUp'
-249: end
-
-
-
-
-
-
-
-
-
-
-
-
-Create a new cookie whose path and domain are same with those of current
-page under test, unless you specified a path for this cookie explicitly.
-
-
-Arguments:
-
-
-- name_value_pair - name and value of the cookie in a format
-"name=value"
-
-
-- options_string - options for the cookie. Currently supported
-options include ‘path’ and ‘max_age’. The
-options_string‘s format is "path=/path/,
-max_age=60". The order of options are irrelevant, the unit of the
-value of ‘max_age’ is second.
-
-
-
-
[Source]
-
-
-
-260: def create_cookie name_value_pair, options_string
-261: command 'createCookie', name_value_pair, options_string
-262: end
-
-
-
-
-
-
-
-
-
-
-
-
-Delete a named cookie with specified path.
-
-
[Source]
-
-
-
-265: def delete_cookie name, path
-266: command 'deleteCookie', name, path
-267: end
-
-
-
-
-
-
-
-
-
-
-
-
-Double clicks on a link, button, checkbox or radio button. If the double click action causes a new page
-to load (like a link usually does), call wait_for_page_to_load.
-
-
[Source]
-
-
-
-271: def double_click locator
-272: command 'doubleClick', locator
-273: end
-
-
-
-
-
-
-
-
-
-
-
-
-Doubleclicks on a link, button, checkbox or radio button. If the action
-causes a new page to load (like a link usually does), call wait_for_page_to_load.
-
-
[Source]
-
-
-
-277: def double_click_at locator, coord_string
-278: command 'doubleClickAt', locator, coord_string
-279: end
-
-
-
-
-
-
-
-
-
-
-
-
-Drags an element a certain distance and then drops it.
-
-
[Source]
-
-
-
-282: def drag_and_drop locator, movements_string
-283: command 'dragAndDrop', locator, movements_string
-284: end
-
-
-
-
-
-
-
-
-
-
-
-
-Drags an element and drops it on another element.
-
-
[Source]
-
-
-
-287: def drag_and_drop_to_object locator_of_object_to_be_dragged, locator_of_drag_destination_object
-288: command 'dragAndDropToObject', locator_of_object_to_be_dragged, locator_of_drag_destination_object
-289: end
-
-
-
-
-
-
-
-
-
-
-
-
-Prints the specified message into the third table cell in your Selenese tables. Useful for debugging.
-
-
[Source]
-
-
-
-294: def echo message
-295: command 'echo', message
-296: end
-
-
-
-
-
-
-
-
-
-
-
-
-Explicitly simulate an event (e.g. "focus",
-"blur"), to trigger the corresponding
-"on_event_" handler.
-
-
[Source]
-
-
-
-59: def fire_event locator, event_name
-60: command 'fireEvent', locator, event_name
-61: end
-
-
-
-
-
-
-
-
-
-
-
-
-Simulates the user clicking the "back" button on their browser.
-
-
[Source]
-
-
-
-204: def go_back
-205: command 'goBack'
-206: end
-
-
-
-
-
-
-
-
-
-
-
-
-Briefly changes the backgroundColor of the specified element yellow. Useful
-for debugging.
-
-
[Source]
-
-
-
-300: def highlight locator
-301: command 'highlight', locator
-302: end
-
-
-
-
-
-
-
-
-
-
-
-
-Includes a partial. The path is relative to the Selenium tests root. The
-starting _ and the file extension don‘t have to be specified.
-
-
- #include test/selenium/_partial.*
- include_partial 'partial'
- #include test/selenium/suite/_partial.*
- include_partial 'suite/partial'
- #include test/selenium/suite/_partial.* and provide local assigns
- include_partial 'suite/partial', :foo => bar
-
-
[Source]
-
-
-
-39: def include_partial path, local_assigns = {}
-40: partial = @view.render :partial => path, :locals => local_assigns
-41: @output << partial
-42: end
-
-
-
-
-
-
-
-
-
-
-
-
-Simulates a user pressing a key (without releasing it yet).
-
-
-keycode is the numeric keycode of the key to be pressed, normally
-the ASCII value of that key.
-
-
[Source]
-
-
-
-75: def key_down locator, keycode
-76: command 'keyDown', locator, keycode
-77: end
-
-
-
-
-
-
-
-
-
-
-
-
-Simulates a user pressing and releasing a key.
-
-
-keycode is the numeric keycode of the key to be pressed, normally
-the ASCII value of that key.
-
-
[Source]
-
-
-
-67: def key_press locator, keycode
-68: command 'keyPress', locator, keycode
-69: end
-
-
-
-
-
-
-
-
-
-
-
-
-Simulates a user releasing a key.
-
-
-keycode is the numeric keycode of the key to be released, normally
-the ASCII value of that key.
-
-
[Source]
-
-
-
-83: def key_up locator, keycode
-84: command 'keyUp', locator, keycode
-85: end
-
-
-
-
-
-
-
-
-
-
-
-
-Press the meta key and hold it down until doMetaUp() is called or
-a new page is loaded.
-
-
[Source]
-
-
-
-306: def meta_key_down
-307: command 'metaKeyDown'
-308: end
-
-
-
-
-
-
-
-
-
-
-
-
-Release the meta key.
-
-
[Source]
-
-
-
-311: def meta_key_up
-312: command 'metaKeyUp'
-313: end
-
-
-
-
-
-
-
-
-
-
-
-
-Simulates a user pressing the mouse button (without releasing it yet) on
-the specified element.
-
-
[Source]
-
-
-
-94: def mouse_down locator
-95: command 'mouseDown', locator
-96: end
-
-
-
-
-
-
-
-
-
-
-
-
-Simulates a user pressing the mouse button (without releasing it yet) on
-the specified element.
-
-
[Source]
-
-
-
-317: def mouse_down_at locator, coord_string
-318: command 'mouseDownAt', locator, coord_string
-319: end
-
-
-
-
-
-
-
-
-
-
-
-
-Simulates a user moving the mouse.
-
-
[Source]
-
-
-
-322: def mouse_move locator
-323: command 'mouseMove', locator
-324: end
-
-
-
-
-
-
-
-
-
-
-
-
-Simulates a user moving the mouse relative to the specified element.
-
-
[Source]
-
-
-
-327: def mouse_move_at locator, coord_string
-328: command 'mouseMoveAt', locator, coord_string
-329: end
-
-
-
-
-
-
-
-
-
-
-
-
-Simulates the user moving the mouse off the specified element.
-
-
[Source]
-
-
-
-332: def mouse_out locator
-333: command 'mouseOut', locator
-334: end
-
-
-
-
-
-
-
-
-
-
-
-
-Simulates a user hovering a mouse over the specified element.
-
-
[Source]
-
-
-
-88: def mouse_over locator
-89: command 'mouseOver', locator
-90: end
-
-
-
-
-
-
-
-
-
-
-
-
-Simulates the user releasing the mouse button on the specified element.
-
-
[Source]
-
-
-
-337: def mouse_up locator
-338: command 'mouseUp', locator
-339: end
-
-
-
-
-
-
-
-
-
-
-
-
-Simulates a user pressing the mouse button (without releasing it yet) on
-the specified element.
-
-
[Source]
-
-
-
-343: def mouse_up_at locator, coord_string
-344: command 'mouseUpAt', locator, coord_string
-345: end
-
-
-
-
-
-
-
-
-
-
-
-
-Opens an URL in the test frame. This accepts both relative and absolute
-URLs. The open
-command waits for the page to load before proceeding, i.e. you don‘t
-have to call wait_for_page_to_load.
-
-
-Note: The URL must be on the same domain as the runner HTML due to security
-restrictions in the browser (Same Origin Policy).
-
-
[Source]
-
-
-
-172: def open url
-173: command 'open', url_arg(url)
-174: end
-
-
-
-
-
-
-
-
-
-
-
-
-Opens a popup window (if a window with that ID isn‘t already open). After opening the window,
-you‘ll need to select
-it using the select_window command.
-
-
-This command can also be a useful workaround for bug SEL-339. In some
-cases, Selenium will be unable to intercept a call to window.open (if the
-call occurs during or before the "onLoad" event, for example). In
-those cases, you can force Selenium to notice the open window‘s name by
-using the Selenium openWindow command, using an empty (blank) url, like
-this: open_window("",
-"myFunnyWindow").
-
-
[Source]
-
-
-
-355: def open_window url, window_id
-356: command 'openWindow', url, window_id
-357: end
-
-
-
-
-
-
-
-
-
-
-
-
-Wait for the specified amount of time (in milliseconds).
-
-
[Source]
-
-
-
-360: def pause wait_time
-361: command 'pause', wait_time
-362: end
-
-
-
-
-
-
-
-
-
-
-
-
-Simulates the user clicking the "Refresh" button on their
-browser.
-
-
[Source]
-
-
-
-209: def refresh
-210: command 'refresh'
-211: end
-
-
-
-
-
-
-
-
-
-
-
-
-Unselects all of the selected options in a multi-select element.
-
-
[Source]
-
-
-
-365: def remove_all_selections locator
-366: command 'removeAllSelections', locator
-367: end
-
-
-
-
-
-
-
-
-
-
-
-
-Remove a selection from the set of selected options in a multi-select element using an option
-locator.
-
-
-See the select
-command for more information about option locators.
-
-
[Source]
-
-
-
-156: def remove_selection locator, option_locator
-157: command 'removeSelection', locator, option_locator
-158: end
-
-
-
-
-
-
-
-
-
-
-
-
-Select an option from a drop-down using an option locator.
-
-
-Option locators provide different ways of specifying options of an HTML
-Select element (e.g. for selecting a specific option, or for asserting that
-the selected option satisfies a specification). There are several forms of
-Select Option Locator.
-
-
-
-If no option locator prefix is provided, the default behaviour is to match
-on label.
-
-
[Source]
-
-
-
-140: def select locator, option_locator
-141: command 'select', locator, option_locator
-142: end
-
-
-
-
-
-
-
-
-
-
-
-
-Selects a frame within the current window. (You may invoke this command
-multiple times to select
-nested frames.) To select the
-parent frame, use "relative=parent" as a locator; to select the top frame, use
-"relative=top".
-
-
-You may also use a DOM expression to identify the frame you want directly,
-like this: dom=frames["main"].frames
-
-
[Source]
-
-
-
-375: def select_frame locator
-376: command 'selectFrame', locator
-377: end
-
-
-
-
-
-
-
-
-
-
-
-
-Selects a popup window; once a popup window has been selected, all commands
-go to that window. To select
-the main window again, use nil as the target.
-
-
[Source]
-
-
-
-178: def select_window window_id
-179: command 'selectWindow', window_id||'null'
-180: end
-
-
-
-
-
-
-
-
-
-
-
-
-Writes a message to the status bar and adds a note to the browser-side log.
-
-
-context is the message sent to the browser.
-
-
-log_level_threshold can be nil, :debug,
-:info, :warn or :error.
-
-
[Source]
-
-
-
-448: def set_context context, log_level_threshold = nil
-449: if log_level_threshold
-450: command 'setContext', context, log_level_threshold.to_s
-451: else
-452: command 'setContext', context
-453: end
-454: end
-
-
-
-
-
-
-
-
-
-
-
-
-Moves the text cursor to the specified position in the given input element
-or textarea. This method will fail if the specified element isn‘t an
-input element or textarea.
-
-
[Source]
-
-
-
-381: def set_cursor_position locator, position
-382: command 'setCursorPosition', locator, position
-383: end
-
-
-
-
-
-
-
-
-
-
-
-
-Configure the number of pixels between "mousemove" events during
-dragAndDrop commands (default=10). Setting this value to 0 means that
-we‘ll send a "mousemove" event to every single pixel in
-between the start location and the end location; that can be very slow, and
-may cause some browsers to force the JavaScript to timeout.
-
-
-If the mouse speed is greater than the distance between the two dragged
-objects, we‘ll just send one "mousemove" at the start
-location and then one final one at the end location.
-
-
[Source]
-
-
-
-393: def set_mouse_speed pixels
-394: command 'setMouseSpeed', pixels
-395: end
-
-
-
-
-
-
-
-
-
-
-
-
-Specifies the amount of time that Selenium will wait for actions to
-complete.
-
-
-Actions that require waiting include open and the
-wait_for* actions.
-
-
-The default timeout is 30 seconds.
-
-
-timeout is specified in milliseconds.
-
-
[Source]
-
-
-
-480: def set_timeout timeout
-481: command 'setTimeout', timeout
-482: end
-
-
-
-
-
-
-
-
-
-
-
-
-Tell Selenium on Rails to clear the session and load any fixtures. DO NOT
-CALL THIS AGAINST NON-TEST DATABASES. The supported options are
-:keep_session, :fixtures and :clear_tables
-
-
- setup
- setup :keep_session
- setup :fixtures => :all
- setup :keep_session, :fixtures => [:foo, :bar]
- setup :clear_tables => [:foo, :bar]
-
-
[Source]
-
-
-
-14: def setup options = {}
-15: options = {options => nil} unless options.is_a? Hash
-16:
-17: opts = {:controller => 'selenium', :action => 'setup'}
-18: opts[:keep_session] = true if options.has_key? :keep_session
-19:
-20: [:fixtures, :clear_tables].each do |key|
-21: if (f = options[key])
-22: f = [f] unless f.is_a? Array
-23: opts[key] = f.join ','
-24: end
-25: end
-26:
-27: open opts
-28: end
-
-
-
-
-
-
-
-
-
-
-
-
-Press the shift key and hold it down until doShiftUp() is called
-or a new page is loaded.
-
-
[Source]
-
-
-
-399: def shift_key_down
-400: command 'shiftKeyDown'
-401: end
-
-
-
-
-
-
-
-
-
-
-
-
-Release the shift key.
-
-
[Source]
-
-
-
-404: def shift_key_up
-405: command 'shiftKeyUp'
-406: end
-
-
-
-
-
-
-
-
-
-
-
-
-This command is a synonym for store_expression.
-
-
[Source]
-
-
-
-409: def store expression, variable_name
-410: command 'store', expression, variable_name
-411: end
-
-
-
-
-
-
-
-
-
-
-
-
-Submit the specified form. This is particularly useful for forms without submit buttons, e.g.
-single-input "Search" forms.
-
-
[Source]
-
-
-
-162: def submit locator
-163: command 'submit', locator
-164: end
-
-
-
-
-
-
-
-
-
-
-
-
-Sets the value of an input field, as though you typed it in.
-
-
-Can also be used to set the value of combo boxes, check boxes, etc. In these
-cases, value should be the value of the option selected, not the
-visible text.
-
-
[Source]
-
-
-
-103: def type locator, value
-104: command 'type', locator, value
-105: end
-
-
-
-
-
-
-
-
-
-
-
-
-Simulates keystroke events on the specified element, as though you typed
-the value key-by-key.
-
-
-This is a convenience method for calling key_down, key_up, key_press for every
-character in the specified string; this is useful for dynamic UI widgets
-(like auto-completing combo boxes) that require explicit key events.
-
-
-Unlike the simple "type" command, which forces
-the specified value into the page directly, this command may or may not
-have any visible effect, even in cases where typing keys would normally
-have a visible effect. For example, if you use "type_keys" on a form
-element, you may or may not see the results of what you typed in the field.
-
-
-In some cases, you may need to use the simple "type" command to set the
-value of the field and then the "type_keys" command to
-send the keystroke events corresponding to what you just typed.
-
-
[Source]
-
-
-
-428: def type_keys locator, value
-429: command 'typeKeys', locator, value
-430: end
-
-
-
-
-
-
-
-
-
-
-
-
-Uncheck a toggle-button (checkbox/radio).
-
-
[Source]
-
-
-
-113: def uncheck locator
-114: command 'uncheck', locator
-115: end
-
-
-
-
-
-
-
-
-
-
-
-
-Runs the specified JavaScript snippet repeatedly until it evaluates to
-true. The snippet may have multiple lines, but only the result of
-the last line will be considered.
-
-
-Note that, by default, the snippet will be run in the runner‘s test
-window, not in the window of your application. To get the window of your
-application, you can use the JavaScript snippet
-selenium.browserbot.getCurrentWindow(), and then run your
-JavaScript in there.
-
-
-timeout is specified in milliseconds.
-
-
[Source]
-
-
-
-467: def wait_for_condition script, timeout
-468: command 'waitForCondition', script, timeout
-469: end
-
-
-
-
-
-
-
-
-
-
-
-
-Waits for a new page to load.
-
-
-You can use this command instead of the and_wait suffixes,
-click_and_wait, select_and_wait, type_and_wait
-etc. (which are only available in the JS API).
-
-
-Selenium constantly keeps track of new pages loading, and sets a
-newPageLoaded flag when it first notices a page load. Running any
-other Selenium command after turns the flag to false. Hence, if
-you want to wait for a page to load, you must wait immediately after a
-Selenium command that caused a page-load.
-
-
-timeout is specified in milliseconds.
-
-
[Source]
-
-
-
-497: def wait_for_page_to_load timeout
-498: command 'waitForPageToLoad', timeout
-499: end
-
-
-
-
-
-
-
-
-
-
-
-
-Waits for a popup window to appear and load up.
-
-
-The timeout is specified in milliseconds.
-
-
[Source]
-
-
-
-185: def wait_for_popup window_id, timeout
-186: command 'waitForPopUp', window_id||'null', timeout
-187: end
-
-
-
-
-
-
-
-
-
-
-
-
-Gives focus to a window.
-
-
[Source]
-
-
-
-433: def window_focus window_name
-434: command 'windowFocus', window_name
-435: end
-
-
-
-
-
-
-
-
-
-
-
-
-Resize window to take up the entire screen.
-
-
[Source]
-
-
-
-438: def window_maximize window_name
-439: command 'windowMaximize', window_name
-440: end
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/TestBuilderUserAccessors.html b/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/TestBuilderUserAccessors.html
deleted file mode 100644
index 8b2d19aa..00000000
--- a/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/TestBuilderUserAccessors.html
+++ /dev/null
@@ -1,116 +0,0 @@
-
-
-
-
-
- Module: SeleniumOnRails::TestBuilderUserAccessors
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Create test_builder_user_accessors.rb to support accessors included in
-selenium-core‘s user-extensions.js
-
-
-See test_builder_user_accessors.rb.example for examples matching
-selenium-core‘s user-extensions.js.sample
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/TestBuilderUserActions.html b/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/TestBuilderUserActions.html
deleted file mode 100644
index b163ba01..00000000
--- a/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/TestBuilderUserActions.html
+++ /dev/null
@@ -1,116 +0,0 @@
-
-
-
-
-
- Module: SeleniumOnRails::TestBuilderUserActions
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Create test_builder_user_actions.rb to support actions included in
-selenium-core‘s user-extensions.js
-
-
-See test_builder_user_actions.rb.example for examples matching
-selenium-core‘s user-extensions.js.sample
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRailsConfig.html b/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRailsConfig.html
deleted file mode 100644
index 4fae21bf..00000000
--- a/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRailsConfig.html
+++ /dev/null
@@ -1,150 +0,0 @@
-
-
-
-
-
- Class: SeleniumOnRailsConfig
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Public Class methods
-
-
-
-
-
-
-
-
[Source]
-
-
-
- 5: def self.get var, default = nil
- 6: value = configs[var.to_s]
- 7: value ||= @@defaults[var]
- 8: value ||= default
- 9: value ||= yield if block_given?
-10: value
-11: end
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/doc/files/CHANGELOG.html b/vendor/plugins/selenium-on-rails/doc/files/CHANGELOG.html
deleted file mode 100644
index e367af7f..00000000
--- a/vendor/plugins/selenium-on-rails/doc/files/CHANGELOG.html
+++ /dev/null
@@ -1,422 +0,0 @@
-
-
-
-
-
- File: CHANGELOG
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
REVISION 38
-
change made by Flanagan
-
-- SOR-13 Corrected an
-omission of require statements.
-
-
-
-
REVISION 37
-
change made by Flanagan
-
-- Undone an unwanted commit of modified Rakefile.
-
-
-
-
REVISION 36
-
change made by Flanagan
-
-- SOR-13 Added
-(experimental) support for user-extensions.js.
-
-
-
-
REVISION 35
-
all changes made by Jonas
-
-- SOR-12 removed all
-support for selenium gem
-
-
-- Selenium Core 0.8.2 is now bundled with Selenium on Rails. If you want to
-use other version set the ‘selenium_path’ in config.yml
-
-
-- Updated installation instructions for Windows
-
-
-
-
REVISION 34
-
all changes made by Flanagan
-
-- SOR-11 Fixed related
-assertions for store_checked to use only locator parameter
-
-
-
-
-Warning: Users must change tests that pass two parameters (locator,
-pattern) to verify_checked, verify_not_checked,
-assert_checked, assert_not_checked,
-wait_for_checked, or wait_for_not_checked.
-
-
-Test scripts that continue to use two parameters will be broken, only one
-parameter, the locator, should be passed.
-
-
-For example, |verify_checked|my_checkbox|true| will be interpreted
-as |verify_checked|my_checkboxtrue|| so change the test to
-|verify_checked|my_checkbox||
-
-
-- SOR-9 Added Mac OS X
-browsers to config.yml.example
-
-
-- SOR-10 Added support for
-baseUrl to acceptance_test_runner.rb as added to selenium-core 0.8.2
-
-
-- Added ‘webrick’ to SERVER_COMMAND in acceptance_test_runner.rb
-as parameters do not work with lighttpd
-
-
-- Reversed expected query string in test/renderer_testrb to make tests pass
-
-
-
-
-Note: On Mac OS X, at least, clear_tables comes before fixtures in the
-query string; this may be an environment-specific issue if the test now
-fails on other OSes.
-
-
-- Added this CHANGELOG file and amended the rake rdoc task to include it
-
-
-- Added support in rselenese for a long list of actions and accessors that
-are included in selenium-core (0.8.2 and possibly earlier) but were
-previously missing in selenium-on-rails.
-
-
-
-
-Here are the newly supported actions:
-
-
-Useful for debugging:
-
-
-- brake (alias for selenium-core‘s break, a reserved word in
-Ruby)
-
-
-- echo, :string
-
-
-- highlight, :locator
-
-
-
-
-Keyboard events:
-
-
-- alt_key_down
-
-
-- alt_key_up
-
-
-- control_key_down
-
-
-- control_key_up
-
-
-- meta_key_down
-
-
-- meta_key_up
-
-
-- shift_key_down
-
-
-- shift_key_up
-
-
-- type_keys, :locator, :string
-
-
-
-
-Mouse events:
-
-
-- click_at, :locator, :coord_string
-
-
-- double_click, :locator
-
-
-- double_click_at, :locator, :coord_string
-
-
-- drag_and_drop, :locator, :movements_string
-
-
-- drag_and_drop_to_object, :locator, :locator
-
-
-- mouse_down_at, :locator, :coord_string
-
-
-- mouse_move, :locator
-
-
-- mouse_move_at, :locator, :coord_string
-
-
-- mouse_out, :locator
-
-
-- mouse_up, :locator
-
-
-- mouse_up_at, :locator, :coord_string
-
-
-- set_mouse_speed, :integer
-
-
-
-
-Other actions:
-
-
-- create_cookie, :name_value_pair, :options_string
-
-
-- delete_cookie, :string, :string
-
-
-- open_window, :url, :integer
-
-
-- pause, :timeout
-
-
-- remove_all_selections, :locator
-
-
-- select_frame, :locator
-
-
-- set_cursor_position, :locator, :integer
-
-
-- store, :script, :variable
-
-
-- window_focus, :window_name
-
-
-- window_maximize, :window_name
-
-
-
-
-Here are the newly supported accessors:
-
-
-The following store_* accessors and their associated assert, verify and
-wait_for brethren are fully supported:
-
-
-- store_selected_id, :locator, :variable
-
-
-- store_selected_ids, :locator, :variable
-
-
-- store_selected_index, :locator, :variable
-
-
-- store_selected_indexes, :locator, :variable
-
-
-- store_selected_label, :locator, :variable
-
-
-- store_selected_labels, :locator, :variable
-
-
-- store_selected_value, :locator, :variable
-
-
-- store_selected_values, :locator, :variable
-
-
-- store_something_selected, :locator, :variable
-
-
-- store_all_window_ids, :variable
-
-
-- store_all_window_names, :variable
-
-
-- store_all_window_titles, :variable
-
-
-- store_cookie, :variable
-
-
-- store_log_messages, :variable
-
-
-- store_mouse_speed, :variable
-
-
-- store_cursor_position, :locator, :variable
-
-
-- store_attribute_from_all_windows, :attribute_name, :variable
-
-
-- store_element_height, :locator, :variable
-
-
-- store_element_index, :locator, :variable
-
-
-- store_element_width, :locator, :variable
-
-
-- store_element_position_left, :locator, :variable
-
-
-- store_element_position_top, :locator, :variable
-
-
-
-
-Only the associated assert, verify and wait_for brethren of the following
-store_* accessors are supported by the selenium-core, so these store_*
-accessors create exceptions in SOR:
-
-
-- store_ordered, :locator, :locator, :variable
-
-
-- store_error_on_next, :string
-
-
-- store_failure_on_next, :string
-
-
-- store_whether_this_frame_match_frame_expression, :string, :string,
-:variable
-
-
-- store_whether_this_window_match_window_expression, :string, :string,
-:variable
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/doc/files/README.html b/vendor/plugins/selenium-on-rails/doc/files/README.html
deleted file mode 100644
index 2984f6f9..00000000
--- a/vendor/plugins/selenium-on-rails/doc/files/README.html
+++ /dev/null
@@ -1,321 +0,0 @@
-
-
-
-
-
- File: README
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Welcome to the Selenium on Rails README. Exciting isn’t it?
-
-
Selenium on Rails
-
-
Overview
-
-
Selenium on Rails provides an easy way to test Rails application with
- SeleniumCore[http://www.openqa.org/selenium-core/].
-
-
This plugin does four things:
-
-
- - The Selenium Core files don’t have to pollute /public.
- - No need to create suite files, they are generated on the fly — one suite per directory in /test/selenium (suites can be nested).
- - Instead of writing the test cases in HTML you can use a number of better formats (see Formats).
- - Loading of fixtures and wiping of session (/selenium/setup).
-
-
-
Installation
-
-
Rails periodically changes the way that it renders pages, which unfortunately breaks backwards versions of Selenium on Rails. Therefore there are different
- installation locations depending on your version of Rails:
-
-
Rails 2.2 and up:
-
-
http://svn.openqa.org/svn/selenium-on-rails/stable/selenium-on-rails
-
-
-
Rails 2.1:
-
-
http://svn.openqa.org/svn/selenium-on-rails/tags/rails_2_1/selenium-on-rails
-
-
-
Before Rails 2.1:
-
-
http://svn.openqa.org/svn/selenium-on-rails/tags/pre-rails-2-1/selenium-on-rails
-
-
-
The latest release is always kept on GitHub at
-
-
git clone git://github.com/paytonrules/selenium-on-rails.git
-
-
-
To install:
-
-
- - Install Selenium on Rails: script/plugin install
- - If you‘re on Windows, gem install win32-open3
- - If the RedCloth gem is available the Selenese test cases can use it for better markup.
- - Run the Rakefile in the plugin‘s directory to run the tests in order to see that everything works. (If RedCloth isn‘t installed a few tests will fail since they assume RedCloth is installed.)
- - Create a test case: script/generate selenium
- - Start the server: script/server -e test
- - Point your browser to localhost:3000/selenium
- - If everything works as expected you should see the Selenium test runner. The north east frame contains all your test cases (just one for now), and the north frame contains your test case.
-
-
-
-
-
The test cases can be written in a number of formats. Which one you choose is a matter of taste. You can generate your test files by running script/generate selenium or by creating them manually in your /test/selenium directory.
-
-
RSelenese, .rsel
-
-
RSelenese lets you write your tests in Ruby. This is my favorite format.
-
-
setup :fixtures => :all
- open '/'
- assert_title 'Home'
- ('a'..'z').each {|c| open :controller => 'user', :action => 'create', :name => c }
-
-
-
See SeleniumOnRails::TestBuilder for available commands. IMPORTANT NOTE: RSelenese generates the HTML tables for Selenium behind the scenes when the page is loaded - ONCE. That means code like this:
-
-
(1..10).each do |index|
- do something
- end
-
-
-
Will only be executed when the test is loaded, not when the test is run. This is a common error and leads to tests that work the first time and fail the second time.
-
-
Selenese, .sel
-
-
Selenese is the dumbest format (in a good way). You just write your commands delimited by | characters.
-
-
|open|/selenium/setup|
- |open|/|
- |goBack|
-
-
-
If you don‘t want to write Selenese tests by hand you can use SeleniumIDE which has support for Selenese.
-
-
HTML/RHTML
-
-
You can write your tests in HTML/RHTML but that‘s mostly useful if you have existing tests you want to reuse.
-
-
Partial test cases
-
-
If you have some common actions you want to do in several test cases you can put them in a separate partial test case and include them in your other test cases. This is highly recommended, just as small functions would be recommended in structured programming.
-
-
A partial test case is just like a normal test case besides that its filename has to start with _:
-
-
#_login.rsel
- open '/login'
- type 'name', name
- type 'password', password
- click 'submit', :wait=>true
-
-
-
To include a partial test case in a RSelenese test case:
-
-
include_partial 'login', :name => 'Jane Doe', :password => 'Jane Doe'.reverse
-
-
-
in a Selenese test case:
-
-
|includePartial|login|name=John Doe|password=eoD nhoJ|
-
-
-
and in a RHTML test case:
-
-
<%= render :partial => 'login', :locals => {:name = 'Joe Schmo', :password => 'Joe Schmo'.reverse} %>
-
-
-
Configuration
-
-
There are a number of settings available. You make them by renaming selenium.yml.example to selenium.yml and placing it in your rails app’s config
- file. Make your changes in that file.
-
-
Environments
-
-
Per default this plugin is only available in test environment. You can change this by setting environments, such as:
-
-
#selenium.yml
- environments:
- - test
- - development
-
-
-
Selenium Core path
-
-
If you don‘t want to use the bundled Selenium Core version you can set selenium_path to the directory where Selenium Core is stored.
-
-
#config.yml
- selenium_path: 'c:\selenium'
-
-
-
Rake Task
-
-
You can run all your Selenium tests as a Rake task. If you’re using a continuous builder this is a great way to integrate selenium into your build process. First, if you‘re on Windows, you have to make sure win32-open3 is installed. Then you have to configure which browsers you want to run, like this:
-
-
#config.yml
- browsers:
- firefox: 'c:\Program Files\Mozilla Firefox\firefox.exe'
- ie: 'c:\Program Files\Internet Explorer\iexplore.exe'
-
-
-
Now you‘re all set. First start a server:
-
-
script/server -e test
-
-
-
Then run the tests:
-
-
rake test:acceptance
-
-
-
Now it should work, otherwise let me know!
-
-
Store results
-
-
If you want to store the results from a test:acceptance you just need to set in which directory they should be stored:
-
-
#config.yml
- result_dir: 'c:\result'
-
-
-
So when you run rake test:acceptance the tables with the results will be stored as .html files in that directory.
-
-
user_extension.js
-
-
Selenium has support for user_extension.js which is a way to extend the functionality of Selenium Core. Selenium on Rails now provides the means for you to extend it’s functionality to match.
-
-
To get you started, we’ve included the example files lib/test_builder_user_accessors.rb.example and lib/test_builder_user_actions.rb.example that replicate the sample extensions in Selenium Core’s user-extensions.js.sample.
-
-
To get these examples running, simply remove the .example and .sample extensions
- from the files and restart your server.
-
-
Todo
-
-
-
-
Not todo
-
-
- - Editor
- Creating an editor for the test cases is currently considered out of scope for this plugin. SeleniumIDE[http://www.openqa.org/selenium-ide/] does such a good job and has support[http://wiki.openqa.org/display/SIDE/SeleniumOnRails] for both the Selenese and RSelenese formats.
-
-
-
Credits
-
-
- - Jonas Bengston — original creator
- - Eric Smith, http://blog.8thlight.com/eric — Current Maintainer
- - Jon Tirsen, http://jutopia.tirsen.com — initial inspiration[http://wiki.rubyonrails.com/rails/pages/SeleniumIntegration]
- - Eric Kidd, http://www.randomhacks.net — contribution of RSelenese
- - Marcos Tapajós http://www.improveit.com.br/en/company/tapajos — Several useful features, current committer
- - Ryan Bates, http://railscasts.com — Fixes for Rails 2.1
- - Nando Vieira, http://simplesideias.com.br
- - Gordon McCreight, a neat script that lists any unsupported methods
-
-
-
Contributing ##
-
-
Contributing is simple. Fork this repo, make your changes, then issue a pull request. IMPORTANT I will not take forks that do not have associated unit tests. There must be tests, and they must pass, so I can bring the changes in.
-
-
-
-
For more information, check out the website.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/doc/files/lib/controllers/selenium_controller_rb.html b/vendor/plugins/selenium-on-rails/doc/files/lib/controllers/selenium_controller_rb.html
deleted file mode 100644
index c2048237..00000000
--- a/vendor/plugins/selenium-on-rails/doc/files/lib/controllers/selenium_controller_rb.html
+++ /dev/null
@@ -1,108 +0,0 @@
-
-
-
-
-
-
File: selenium_controller.rb
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Required files
-
-
- webrick/httputils
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_helper_rb.html b/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_helper_rb.html
deleted file mode 100644
index b3e1c97e..00000000
--- a/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_helper_rb.html
+++ /dev/null
@@ -1,101 +0,0 @@
-
-
-
-
-
-
File: selenium_helper.rb
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/acceptance_test_runner_rb.html b/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/acceptance_test_runner_rb.html
deleted file mode 100644
index 46a8c324..00000000
--- a/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/acceptance_test_runner_rb.html
+++ /dev/null
@@ -1,222 +0,0 @@
-
-
-
-
-
-
File: acceptance_test_runner.rb
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Required files
-
-
- net/http
- tempfile
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Constants
-
-
-
-
- | BROWSERS |
- = |
- c :browsers, {} |
-
-
- | REUSE_EXISTING_SERVER |
- = |
- c :reuse_existing_server, true |
-
-
- | START_SERVER |
- = |
- c :start_server, false |
-
-
- | HOST |
- = |
- c :host, 'localhost' |
-
-
- | PORTS |
- = |
- c(:port_start, 3000)..c(:port_end, 3005) |
-
-
- | BASE_URL_PATH |
- = |
- c :base_url_path, '/' |
-
-
- | TEST_RUNNER_URL |
- = |
- c :test_runner_url, '/selenium/TestRunner.html' |
-
-
- | MAX_BROWSER_DURATION |
- = |
- c :max_browser_duration, 2*60 |
-
-
- | MULTI_WINDOW |
- = |
- c :multi_window, false |
-
-
- | SERVER_COMMAND |
- = |
- c_b :server_command do
server_path = File.expand_path(File.dirname(__FILE__) + '/../../../../../script/server') |
-
-
-
-
-
-
-
-
-
-
-
-
-
Public Instance methods
-
-
-
-
-
-
-
-
[Source]
-
-
-
-7: def c(var, default = nil) SeleniumOnRailsConfig.get var, default end
-
-
-
-
-
-
-
-
-
-
-
-
[Source]
-
-
-
-8: def c_b(var, default = nil) SeleniumOnRailsConfig.get(var, default) { yield } end
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/fixture_loader_rb.html b/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/fixture_loader_rb.html
deleted file mode 100644
index 8c2157ee..00000000
--- a/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/fixture_loader_rb.html
+++ /dev/null
@@ -1,109 +0,0 @@
-
-
-
-
-
-
File: fixture_loader.rb
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Required files
-
-
- test/unit
- active_record/fixtures
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/partials_support_rb.html b/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/partials_support_rb.html
deleted file mode 100644
index 4b981a54..00000000
--- a/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/partials_support_rb.html
+++ /dev/null
@@ -1,111 +0,0 @@
-
-
-
-
-
-
File: partials_support.rb
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Provides partials support to test cases so they can include other partial
-test cases.
-
-
-The partial‘s commands are returned as html table rows.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/paths_rb.html b/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/paths_rb.html
deleted file mode 100644
index 5e688d5b..00000000
--- a/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/paths_rb.html
+++ /dev/null
@@ -1,101 +0,0 @@
-
-
-
-
-
-
File: paths.rb
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/renderer_rb.html b/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/renderer_rb.html
deleted file mode 100644
index 0774a973..00000000
--- a/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/renderer_rb.html
+++ /dev/null
@@ -1,101 +0,0 @@
-
-
-
-
-
-
File: renderer.rb
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/rselenese_rb.html b/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/rselenese_rb.html
deleted file mode 100644
index 38ccc73b..00000000
--- a/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/rselenese_rb.html
+++ /dev/null
@@ -1,118 +0,0 @@
-
-
-
-
-
-
File: rselenese.rb
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Renders Selenium test templates in a fashion analogous to rxml and
-rjs templates.
-
-
- setup
- open :controller => 'customer', :action => 'list'
- assert_title 'Customers'
-
-
-See SeleniumOnRails::TestBuilder
-for a list of available commands.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/selenese_rb.html b/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/selenese_rb.html
deleted file mode 100644
index 1f40e1c4..00000000
--- a/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/selenese_rb.html
+++ /dev/null
@@ -1,101 +0,0 @@
-
-
-
-
-
-
File: selenese.rb
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/suite_renderer_rb.html b/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/suite_renderer_rb.html
deleted file mode 100644
index 4ec5b7e0..00000000
--- a/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/suite_renderer_rb.html
+++ /dev/null
@@ -1,101 +0,0 @@
-
-
-
-
-
-
File: suite_renderer.rb
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/test_builder_accessors_rb.html b/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/test_builder_accessors_rb.html
deleted file mode 100644
index c375cd5e..00000000
--- a/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/test_builder_accessors_rb.html
+++ /dev/null
@@ -1,114 +0,0 @@
-
-
-
-
-
-
File: test_builder_accessors.rb
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-The accessors available for SeleniumOnRails::TestBuilder
-tests.
-
-
-For each store_foo there‘s assert_foo,
-assert_not_foo, verify_foo, verify_not_foo,
-wait_for_foo, wait_for_not_foo.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/test_builder_actions_rb.html b/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/test_builder_actions_rb.html
deleted file mode 100644
index 2896def6..00000000
--- a/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/test_builder_actions_rb.html
+++ /dev/null
@@ -1,113 +0,0 @@
-
-
-
-
-
-
File: test_builder_actions.rb
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/test_builder_rb.html b/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/test_builder_rb.html
deleted file mode 100644
index 4c5a5962..00000000
--- a/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/test_builder_rb.html
+++ /dev/null
@@ -1,120 +0,0 @@
-
-
-
-
-
-
File: test_builder.rb
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Create test_builder_user_actions.rb to support actions included in
-selenium-core‘s user-extensions.js
-
-
-See test_builder_user_actions.rb.example for examples matching
-selenium-core‘s user-extensions.js.sample
-
-
-
-
-
-
Required files
-
-
- selenium_on_rails/test_builder_user_actions
- selenium_on_rails/test_builder_user_accessors
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails_config_rb.html b/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails_config_rb.html
deleted file mode 100644
index 042a702b..00000000
--- a/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails_config_rb.html
+++ /dev/null
@@ -1,108 +0,0 @@
-
-
-
-
-
-
File: selenium_on_rails_config.rb
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Required files
-
-
- yaml
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails_rb.html b/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails_rb.html
deleted file mode 100644
index 5d664b29..00000000
--- a/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails_rb.html
+++ /dev/null
@@ -1,115 +0,0 @@
-
-
-
-
-
-
File: selenium_on_rails.rb
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Required files
-
-
- selenium_on_rails/selenese
- selenium_on_rails/test_builder
- selenium_on_rails/rselenese
- selenium_on_rails/suite_renderer
- selenium_on_rails/paths
- selenium_on_rails/fixture_loader
- selenium_on_rails/partials_support
- selenium_on_rails/renderer
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/doc/fr_class_index.html b/vendor/plugins/selenium-on-rails/doc/fr_class_index.html
deleted file mode 100644
index 9109fec5..00000000
--- a/vendor/plugins/selenium-on-rails/doc/fr_class_index.html
+++ /dev/null
@@ -1,42 +0,0 @@
-
-
-
-
-
-
-
-
Classes
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/doc/fr_file_index.html b/vendor/plugins/selenium-on-rails/doc/fr_file_index.html
deleted file mode 100644
index 06a0126b..00000000
--- a/vendor/plugins/selenium-on-rails/doc/fr_file_index.html
+++ /dev/null
@@ -1,43 +0,0 @@
-
-
-
-
-
-
-
-
Files
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/doc/fr_method_index.html b/vendor/plugins/selenium-on-rails/doc/fr_method_index.html
deleted file mode 100644
index 6ea4dace..00000000
--- a/vendor/plugins/selenium-on-rails/doc/fr_method_index.html
+++ /dev/null
@@ -1,182 +0,0 @@
-
-
-
-
-
-
-
-
Methods
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/doc/index.html b/vendor/plugins/selenium-on-rails/doc/index.html
deleted file mode 100644
index 4baa4f94..00000000
--- a/vendor/plugins/selenium-on-rails/doc/index.html
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
-
-
-
SeleniumOnRails
-
-
-
-
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/doc/rdoc-style.css b/vendor/plugins/selenium-on-rails/doc/rdoc-style.css
deleted file mode 100644
index 44c7b3d1..00000000
--- a/vendor/plugins/selenium-on-rails/doc/rdoc-style.css
+++ /dev/null
@@ -1,208 +0,0 @@
-
-body {
- font-family: Verdana,Arial,Helvetica,sans-serif;
- font-size: 90%;
- margin: 0;
- margin-left: 40px;
- padding: 0;
- background: white;
-}
-
-h1,h2,h3,h4 { margin: 0; color: #efefef; background: transparent; }
-h1 { font-size: 150%; }
-h2,h3,h4 { margin-top: 1em; }
-
-a { background: #eef; color: #039; text-decoration: none; }
-a:hover { background: #039; color: #eef; }
-
-/* Override the base stylesheet's Anchor inside a table cell */
-td > a {
- background: transparent;
- color: #039;
- text-decoration: none;
-}
-
-/* and inside a section title */
-.section-title > a {
- background: transparent;
- color: #eee;
- text-decoration: none;
-}
-
-/* === Structural elements =================================== */
-
-div#index {
- margin: 0;
- margin-left: -40px;
- padding: 0;
- font-size: 90%;
-}
-
-
-div#index a {
- margin-left: 0.7em;
-}
-
-div#index .section-bar {
- margin-left: 0px;
- padding-left: 0.7em;
- background: #ccc;
- font-size: small;
-}
-
-
-div#classHeader, div#fileHeader {
- width: auto;
- color: white;
- padding: 0.5em 1.5em 0.5em 1.5em;
- margin: 0;
- margin-left: -40px;
- border-bottom: 3px solid #006;
-}
-
-div#classHeader a, div#fileHeader a {
- background: inherit;
- color: white;
-}
-
-div#classHeader td, div#fileHeader td {
- background: inherit;
- color: white;
-}
-
-
-div#fileHeader {
- background: #057;
-}
-
-div#classHeader {
- background: #048;
-}
-
-
-.class-name-in-header {
- font-size: 180%;
- font-weight: bold;
-}
-
-
-div#bodyContent {
- padding: 0 1.5em 0 1.5em;
-}
-
-div#description {
- padding: 0.5em 1.5em;
- background: #efefef;
- border: 1px dotted #999;
-}
-
-div#description h1,h2,h3,h4,h5,h6 {
- color: #125;;
- background: transparent;
-}
-
-div#validator-badges {
- text-align: center;
-}
-div#validator-badges img { border: 0; }
-
-div#copyright {
- color: #333;
- background: #efefef;
- font: 0.75em sans-serif;
- margin-top: 5em;
- margin-bottom: 0;
- padding: 0.5em 2em;
-}
-
-
-/* === Classes =================================== */
-
-table.header-table {
- color: white;
- font-size: small;
-}
-
-.type-note {
- font-size: small;
- color: #DEDEDE;
-}
-
-.xxsection-bar {
- background: #eee;
- color: #333;
- padding: 3px;
-}
-
-.section-bar {
- color: #333;
- border-bottom: 1px solid #999;
- margin-left: -20px;
-}
-
-
-.section-title {
- background: #79a;
- color: #eee;
- padding: 3px;
- margin-top: 2em;
- margin-left: -30px;
- border: 1px solid #999;
-}
-
-.top-aligned-row { vertical-align: top }
-.bottom-aligned-row { vertical-align: bottom }
-
-/* --- Context section classes ----------------------- */
-
-.context-row { }
-.context-item-name { font-family: monospace; font-weight: bold; color: black; }
-.context-item-value { font-size: small; color: #448; }
-.context-item-desc { color: #333; padding-left: 2em; }
-
-/* --- Method classes -------------------------- */
-.method-detail {
- background: #efefef;
- padding: 0;
- margin-top: 0.5em;
- margin-bottom: 1em;
- border: 1px dotted #ccc;
-}
-.method-heading {
- color: black;
- background: #ccc;
- border-bottom: 1px solid #666;
- padding: 0.2em 0.5em 0 0.5em;
-}
-.method-signature { color: black; background: inherit; }
-.method-name { font-weight: bold; }
-.method-args { font-style: italic; }
-.method-description { padding: 0 0.5em 0 0.5em; }
-
-/* --- Source code sections -------------------- */
-
-a.source-toggle { font-size: 90%; }
-div.method-source-code {
- background: #262626;
- color: #ffdead;
- margin: 1em;
- padding: 0.5em;
- border: 1px dashed #999;
- overflow: hidden;
-}
-
-div.method-source-code pre { color: #ffdead; overflow: hidden; }
-
-/* --- Ruby keyword styles --------------------- */
-
-.standalone-code { background: #221111; color: #ffdead; overflow: hidden; }
-
-.ruby-constant { color: #7fffd4; background: transparent; }
-.ruby-keyword { color: #00ffff; background: transparent; }
-.ruby-ivar { color: #eedd82; background: transparent; }
-.ruby-operator { color: #00ffee; background: transparent; }
-.ruby-identifier { color: #ffdead; background: transparent; }
-.ruby-node { color: #ffa07a; background: transparent; }
-.ruby-comment { color: #b22222; font-weight: bold; background: transparent; }
-.ruby-regexp { color: #ffa07a; background: transparent; }
-.ruby-value { color: #7fffd4; background: transparent; }
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/generators/selenium/USAGE b/vendor/plugins/selenium-on-rails/generators/selenium/USAGE
deleted file mode 100644
index 1a6ae9f0..00000000
--- a/vendor/plugins/selenium-on-rails/generators/selenium/USAGE
+++ /dev/null
@@ -1,19 +0,0 @@
-Description:
- Generates a stub Selenium test case.
-
-Examples:
- ./script/generate selenium login
- will create:
- /test/selenium/login.sel
-
- ./script/generate selenium user/create
- will create:
- /test/selenium/user/create.sel
-
- ./script/generate selenium login.rsel
- will create:
- /test/selenium/login.rsel
-
- ./script/generate selenium logout.rhtml
- will create:
- /test/selenium/logout.rhtml
diff --git a/vendor/plugins/selenium-on-rails/generators/selenium/selenium_generator.rb b/vendor/plugins/selenium-on-rails/generators/selenium/selenium_generator.rb
deleted file mode 100644
index bc51ef5a..00000000
--- a/vendor/plugins/selenium-on-rails/generators/selenium/selenium_generator.rb
+++ /dev/null
@@ -1,50 +0,0 @@
-class SeleniumGenerator < Rails::Generator::Base
- def initialize runtime_args, runtime_options = {}
- super
- usage if @args.empty?
- end
-
- def banner
- "Usage: #{$0} #{spec.name} testname [options]"
- end
-
- def manifest
- record do |m|
- path = 'test/selenium'
- path = File.join(path, suite_path) unless suite_path.empty?
- m.directory path
-
- template = case File.extname(filename)
- when '.rhtml' then 'rhtml.rhtml'
- when '.rsel' then 'rselenese.rhtml'
- else 'selenese.rhtml'
- end
- m.template template, File.join(path, filename)
- end
- end
-
- def filename
- name = File.basename args[0]
- extensions = ['.sel', '.rhtml', '.rsel']
- name = "#{name}.sel" unless extensions.include? File.extname(name)
- name
- end
-
- def suite_path
- sp = File.dirname args[0]
- sp = '' if sp == '.'
- sp
- end
-
- def testcase_link
- l = "http://localhost:3000/selenium/tests/"
- l = "#{l}#{suite_path}/" unless suite_path.empty?
- l + filename
- end
-
- def suite_link
- l = "http://localhost:3000/selenium"
- l = "#{l}/TestRunner.html?test=tests/#{suite_path}" unless suite_path.empty?
- l
- end
-end
diff --git a/vendor/plugins/selenium-on-rails/generators/selenium/templates/rhtml.rhtml b/vendor/plugins/selenium-on-rails/generators/selenium/templates/rhtml.rhtml
deleted file mode 100644
index c6c4c441..00000000
--- a/vendor/plugins/selenium-on-rails/generators/selenium/templates/rhtml.rhtml
+++ /dev/null
@@ -1,16 +0,0 @@
-
It's often a good idea to start the test with opening /selenium/setup (see <%%= link_to 'here', :controller => 'selenium', :action => 'setup' %> for more info).
-
-
- | <%%= @page_title %> |
- | open | /selenium/setup | |
-<%% for page in ['/', '/home'] -%>
- | open | <%%= page %> | |
- | assertTitle | Home | |
-<%% end -%>
-
-
-
More information about the commands is available here.
-
-
You can write comments above and below the commands, but you can only have one set of commands, i.e. one table, per test.
-
-
Point the browser to <%= testcase_link %> to see how this test is rendered, or to <%= suite_link %> to run the suite.
diff --git a/vendor/plugins/selenium-on-rails/generators/selenium/templates/rselenese.rhtml b/vendor/plugins/selenium-on-rails/generators/selenium/templates/rselenese.rhtml
deleted file mode 100644
index 419eb368..00000000
--- a/vendor/plugins/selenium-on-rails/generators/selenium/templates/rselenese.rhtml
+++ /dev/null
@@ -1,14 +0,0 @@
-# It's often a good idea to start the test with 'setup'.
-# See /selenium/setup for more info.
-
-setup
-open '/'
-assert_title 'Home'
-
-# More information about the commands is available at:
-# http://release.openqa.org/selenium-core/nightly/reference.html
-# See also the RDoc for SeleniumOnRails::TestBuilder.
-#
-# Point the browser to <%= testcase_link %> to see
-# how this test is rendered, or to <%= suite_link %> to
-# run the suite.
diff --git a/vendor/plugins/selenium-on-rails/generators/selenium/templates/selenese.rhtml b/vendor/plugins/selenium-on-rails/generators/selenium/templates/selenese.rhtml
deleted file mode 100644
index f4ccb8a9..00000000
--- a/vendor/plugins/selenium-on-rails/generators/selenium/templates/selenese.rhtml
+++ /dev/null
@@ -1,11 +0,0 @@
-It's often a good idea to start the test with opening
/selenium/setup (see "here":/selenium/setup for more info).
-
-|open|/selenium/setup|
-|open|/|
-|assertTitle|Home|
-
-More information about the commands is available "here":http://release.openqa.org/selenium-core/nightly/reference.html.
-
-You can write comments above and below the commands, but you can only have one set of commands, i.e. one table, per test. "RedCloth":http://www.whytheluckystiff.net/ruby/redcloth/ is used for formatting if installed.
-
-Point the browser to "<%= testcase_link %>":<%= testcase_link %> to see how this test is rendered, or to "<%= suite_link %>":<%= suite_link %> to run the suite.
diff --git a/vendor/plugins/selenium-on-rails/init.rb b/vendor/plugins/selenium-on-rails/init.rb
deleted file mode 100644
index 185b5847..00000000
--- a/vendor/plugins/selenium-on-rails/init.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-require 'selenium_on_rails_config'
-envs = SeleniumOnRailsConfig.get :environments
-
-if envs.include? RAILS_ENV
- #initialize the plugin
- $LOAD_PATH << File.dirname(__FILE__) + "/lib/controllers"
- require 'selenium_controller'
- require File.dirname(__FILE__) + '/routes'
-
- SeleniumController.prepend_view_path File.expand_path(File.dirname(__FILE__) + '/lib/views')
-else
- #erase all traces
- $LOAD_PATH.delete lib_path
-end
-
diff --git a/vendor/plugins/selenium-on-rails/lib/controllers/selenium_controller.rb b/vendor/plugins/selenium-on-rails/lib/controllers/selenium_controller.rb
deleted file mode 100644
index 02e3df8b..00000000
--- a/vendor/plugins/selenium-on-rails/lib/controllers/selenium_controller.rb
+++ /dev/null
@@ -1,122 +0,0 @@
-require 'webrick/httputils'
-
-class SeleniumController < ActionController::Base
- include SeleniumOnRails::FixtureLoader
- include SeleniumOnRails::Renderer
-
- def initialize
- @result_dir = SeleniumOnRailsConfig.get(:result_dir)
- end
-
- def setup
- unless params.has_key? :keep_session
- reset_session # IS THIS WORKING! NO THINK SO
- @session_wiped = true
- end
- @cleared_tables = clear_tables params[:clear_tables].to_s
- @loaded_fixtures = load_fixtures params[:fixtures].to_s
- render :file => view_path('setup.rhtml'), :layout => layout_path\
- end
-
- def test_file
- params[:testname] = '' if params[:testname].to_s == 'TestSuite.html'
- filename = File.join selenium_tests_path, params[:testname]
- if File.directory? filename
- @suite_path = filename
- render :file => view_path('test_suite.rhtml'), :layout => layout_path
- elsif File.readable? filename
- render_test_case filename
- else
- if File.directory? selenium_tests_path
- render :text => 'Not found', :status => 404
- else
- render :text => "Did not find the Selenium tests path (#{selenium_tests_path}). Run script/generate selenium", :status => 404
- end
- end
- end
-
- def support_file
- if params[:filename].empty?
- redirect_to :filename => 'TestRunner.html', :test => 'tests'
- return
- end
-
- filename = File.join selenium_path, params[:filename]
- if File.file? filename
- type = WEBrick::HTTPUtils::DefaultMimeTypes[$1.downcase] if filename =~ /\.(\w+)$/
- type ||= 'text/html'
- send_file filename, :type => type, :disposition => 'inline', :stream => false
- else
- render :text => 'Not found', :status => 404
- end
- end
-
- def record
- dir = record_table
-
- @result = {'resultDir' => dir}
- ['result', 'numTestFailures', 'numTestPasses', 'numCommandFailures', 'numCommandPasses', 'numCommandErrors', 'totalTime'].each do |item|
- @result[item] = params[item]
- end
-
- File.open(log_path(params[:logFile] || 'default.yml'), 'w') {|f| YAML.dump(@result, f)}
-
- render :file => view_path('record.rhtml'), :layout => layout_path
- end
-
- def record_table
- return nil unless @result_dir
-
- cur_result_dir = File.join(@result_dir, (params[:logFile] || "default").sub(/\.yml$/, ''))
- FileUtils.mkdir_p(cur_result_dir)
- File.open("#{cur_result_dir}/index.html", "wb") do |f|
- f.write <
-Selenium Test Result
-
-
-
-
-
-EOS
- end
- html_header = <
-
-
-
-
-EOS
- html_footer = "\n"
- if selenium_path
- css_file = File.join selenium_path, "selenium-test.css"
- if File.exist?(css_file)
- FileUtils.cp css_file, cur_result_dir
- end
- end
- File.open("#{cur_result_dir}/blank.html", "wb") do |f|
- f.write ""
- end
- File.open("#{cur_result_dir}/suite.html", "wb") do |f|
- suite = params[:suite]
- suite.sub!(/^.*(])/im, '\1')
- i = 1
- suite.gsub!(/(\shref=)"[^"]*"/i) do |m|
- link = "#{$1}\"test#{i}.html\" target=\"testcase\""
- File.open("#{cur_result_dir}/test#{i}.html", "wb") do |testcase|
- testcase.write html_header
- testcase.write(params["testTable.#{i}"])
- testcase.write html_footer
- end
- i += 1
- link
- end
- f.write html_header
- f.write suite
- f.write html_footer
- end
- cur_result_dir
- end
-
- private :record_table
-end
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/lib/controllers/switch_environment_controller.rb b/vendor/plugins/selenium-on-rails/lib/controllers/switch_environment_controller.rb
deleted file mode 100644
index 67e8ae50..00000000
--- a/vendor/plugins/selenium-on-rails/lib/controllers/switch_environment_controller.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-class SwitchEnvironmentController < ActionController::Base
- def index
- readme_path = File.expand_path File.join(File.dirname(__FILE__), '..', 'README')
- render :status => 500, :locals => {:readme_path => readme_path }, :inline => <
- Selenium on Rails is only activated for <%= SeleniumOnRailsConfig.get(:environments).join ', ' %>
- environment<%= SeleniumOnRailsConfig.get(:environments).size > 1 ? 's' : '' %> (you're running
- <%= RAILS_ENV %>).
-
-
- Start your server in a different environment or see <%= readme_path %>
- for information regarding how to change this behavior.
-
-END
- end
-end
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/lib/selenium_helper.rb b/vendor/plugins/selenium-on-rails/lib/selenium_helper.rb
deleted file mode 100644
index f3b1f3c7..00000000
--- a/vendor/plugins/selenium-on-rails/lib/selenium_helper.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-module SeleniumHelper
- include SeleniumOnRails::SuiteRenderer
- include SeleniumOnRails::FixtureLoader
-
- def test_case_name filename
- File.basename(filename).sub(/\..*/,'').humanize
- end
-end
diff --git a/vendor/plugins/selenium-on-rails/lib/selenium_on_rails.rb b/vendor/plugins/selenium-on-rails/lib/selenium_on_rails.rb
deleted file mode 100644
index 365d0034..00000000
--- a/vendor/plugins/selenium-on-rails/lib/selenium_on_rails.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-module SeleniumOnRails # :nodoc
-end
-
-require 'selenium_on_rails/selenese'
-require 'selenium_on_rails/test_builder'
-require 'selenium_on_rails/rselenese'
-require 'selenium_on_rails/suite_renderer'
-require 'selenium_on_rails/paths'
-require 'selenium_on_rails/fixture_loader'
-require 'selenium_on_rails/partials_support'
-require 'selenium_on_rails/renderer'
diff --git a/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/acceptance_test_runner.rb b/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/acceptance_test_runner.rb
deleted file mode 100644
index 69afffda..00000000
--- a/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/acceptance_test_runner.rb
+++ /dev/null
@@ -1,214 +0,0 @@
-$: << File.expand_path(File.dirname(__FILE__) + "/")
-$: << File.expand_path(File.dirname(__FILE__) + "/../")
-require 'paths'
-require 'net/http'
-require 'tempfile'
-
-
-def c(var, default = nil) SeleniumOnRailsConfig.get var, default end
-def c_b(var, default = nil) SeleniumOnRailsConfig.get(var, default) { yield } end
-
-BROWSERS = c :browsers, {}
-REUSE_EXISTING_SERVER = c :reuse_existing_server, true
-START_SERVER = c :start_server, false #TODO can't get it to work reliably on Windows, perhaps it's just on my computer, but I leave it off by default for now
-HOST = c :host, 'localhost'
-PORTS = c(:port_start, 3000)..c(:port_end, 3005)
-BASE_URL_PATH = c :base_url_path, '/'
-TEST_RUNNER_URL = c :test_runner_url, '/selenium/TestRunner.html'
-MAX_BROWSER_DURATION = c :max_browser_duration, 2*60
-MULTI_WINDOW = c :multi_window, false
-SERVER_COMMAND = c_b :server_command do
- server_path = File.expand_path(File.dirname(__FILE__) + '/../../../../../script/server')
- if RUBY_PLATFORM =~ /mswin/
- "ruby #{server_path} webrick -p %d -e test > NUL 2>&1"
- else
- # don't use redirects to /dev/nul since it makes the fork return wrong pid
- # see UnixSubProcess
- "#{server_path} webrick -p %d -e test"
- end
-end
-
-module SeleniumOnRails
- class AcceptanceTestRunner
- include SeleniumOnRails::Paths
-
- def run
- raise 'no browser specified, edit/create config.yml' if BROWSERS.empty?
- start_server
- has_error = false
- begin
- BROWSERS.each_pair do |browser, path|
- log_file = start_browser browser, path
- wait_for_completion log_file
- stop_browser
- result = YAML::load_file log_file
- print_result result
- has_error ||= result['numTestFailures'].to_i > 0
- # File.delete log_file unless has_error
- end
- rescue
- stop_server
- raise
- end
- stop_server
- raise 'Test failures' if has_error
- end
-
- private
- def start_server
- PORTS.each do |p|
- @port = p
- case server_check
- when :success
- return if REUSE_EXISTING_SERVER
- next
- when Fixnum
- next
- when :no_response
- next unless START_SERVER
- do_start_server
- return
- end
- end
- raise START_SERVER ? 'failed to start server': 'failed to find existing server, run script/server -e test'
- end
-
- def do_start_server
- puts 'Starting server'
- @server = start_subprocess(format(SERVER_COMMAND, @port))
- while true
- print '.'
- r = server_check
- if r == :success
- puts
- return
- end
- raise "server returned error: #{r}" if r.instance_of? Fixnum
- sleep 3
- end
- end
-
- def server_check
- begin
- res = Net::HTTP.get_response HOST, TEST_RUNNER_URL, @port
- return :success if (200..399).include? res.code.to_i
- return res.code.to_i
- rescue Errno::ECONNREFUSED
- return :no_response
- end
- end
-
- def stop_server
- return unless defined? @server
- puts
- @server.stop 'server'
- end
-
- def start_browser browser, path
- puts
- puts "Starting #{browser}"
- base_url = "http://#{HOST}:#{@port}#{BASE_URL_PATH}"
- log = log_file browser
- command = "\"#{path}\" \"http://#{HOST}:#{@port}#{TEST_RUNNER_URL}?test=tests&auto=true&baseUrl=#{base_url}&resultsUrl=postResults/#{log}&multiWindow=#{MULTI_WINDOW}\""
- @browser = start_subprocess command
- log_path log
- end
-
- def stop_browser
- @browser.stop 'browser'
- end
-
- def start_subprocess command
- if RUBY_PLATFORM =~ /mswin/
- SeleniumOnRails::AcceptanceTestRunner::Win32SubProcess.new command
- elsif RUBY_PLATFORM =~ /darwin/i && command =~ /safari/i
- SeleniumOnRails::AcceptanceTestRunner::SafariSubProcess.new command
- else
- SeleniumOnRails::AcceptanceTestRunner::UnixSubProcess.new command
- end
- end
-
- def log_file browser
- FileUtils.mkdir_p(log_path(''))
- (0..100).each do |i|
- name = browser + (i==0 ? '' : "(#{i})") + '.yml'
- return name unless File.exist?(log_path(name))
- end
- raise 'there are way too many files in the log directory...'
- end
-
- def wait_for_completion log_file
- duration = 0
- while true
- raise 'browser takes too long' if duration > MAX_BROWSER_DURATION
- print '.'
- break if File.exist? log_file
- sleep 5
- duration += 5
- end
- puts
- end
-
- def print_result result
- puts "Finished in #{result['totalTime']} seconds."
- puts
- puts "#{result['numTestPasses']} tests passed, #{result['numTestFailures']} tests failed"
- puts "(Results stored in '#{result['resultDir']}')" if result['resultDir']
- end
-
- end
-end
-
-class SeleniumOnRails::AcceptanceTestRunner::SubProcess
- def stop what
- begin
- puts "Stopping #{what} (pid=#{@pid}) ..."
- Process.kill 9, @pid
- rescue Errno::EPERM #such as the process is already closed (tabbed browser)
- end
- end
-end
-
-class SeleniumOnRails::AcceptanceTestRunner::Win32SubProcess < SeleniumOnRails::AcceptanceTestRunner::SubProcess
- def initialize command
- require 'win32/open3' #win32-open3 http://raa.ruby-lang.org/project/win32-open3/
-
- puts command
- input, output, error, @pid = Open4.popen4 command, 't', true
- end
-end
-
-class SeleniumOnRails::AcceptanceTestRunner::UnixSubProcess < SeleniumOnRails::AcceptanceTestRunner::SubProcess
- def initialize command
- puts command
- @pid = fork do
- # Since we can't use shell redirects without screwing
- # up the pid, we'll reopen stdin and stdout instead
- # to get the same effect.
- [STDOUT,STDERR].each {|f| f.reopen '/dev/null', 'w' }
- exec command
- end
- end
-end
-
-# The path to Safari should look like this: /Applications/Safari.app/Contents/MacOS/Safari
-class SeleniumOnRails::AcceptanceTestRunner::SafariSubProcess < SeleniumOnRails::AcceptanceTestRunner::UnixSubProcess
- def initialize command
- f = File.open(Tempfile.new('selenium-on-rails').path, 'w')
- f.puts <<-HTML
-
-
-
-
-
-
- HTML
- f.close
-
- super "#{command.split.first} #{f.path}"
- end
-
-end
-
diff --git a/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/fixture_loader.rb b/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/fixture_loader.rb
deleted file mode 100644
index 77cd6203..00000000
--- a/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/fixture_loader.rb
+++ /dev/null
@@ -1,57 +0,0 @@
-require 'test/unit'
-require 'active_record'
-require 'active_record/fixtures'
-
-module SeleniumOnRails::FixtureLoader
- include SeleniumOnRails::Paths
-
- def available_fixtures
- fixtures = {}
- path = fixtures_path + '/'
- files = Dir["#{path}**/*.{yml,csv}"]
- files.each do |file|
- rel_path = file.sub(path, '')
- next if skip_file? rel_path
- fixture_set = File.dirname(rel_path)
- fixture_set = '' if fixture_set == '.'
- fixture = rel_path.sub /\.[^.]*$/, ''
- fixtures[fixture_set] ||= []
- fixtures[fixture_set] << fixture
- end
-
- fixtures
- end
-
- def load_fixtures fixtures_param
- available = nil
- fixtures = fixtures_param.split(/\s*,\s*/).collect do |f|
- fixture_set = File.dirname f
- fixture_set = '' if fixture_set == '.'
- fixture = File.basename f
- if fixture == 'all'
- available ||= available_fixtures
- available[fixture_set]
- else
- f
- end
- end
- fixtures.flatten!
- fixtures.reject! {|f| f.blank? }
-
- if fixtures.any?
- Fixtures.reset_cache # in case they've already been loaded and things have changed
- Fixtures.create_fixtures fixtures_path, fixtures
- end
- fixtures
- end
-
- def clear_tables tables
- table_names = tables.split /\s*,\s*/
- connection = ActiveRecord::Base.connection
- table_names.each do |table|
- connection.execute "DELETE FROM #{table}"
- end
- table_names
- end
-
-end
diff --git a/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/partials_support.rb b/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/partials_support.rb
deleted file mode 100644
index b9d557ef..00000000
--- a/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/partials_support.rb
+++ /dev/null
@@ -1,36 +0,0 @@
-require 'selenium_on_rails/paths'
-
-module SeleniumOnRails::PartialsSupport
- include SeleniumOnRails::Paths
-
- # Overrides where the partial is searched for, and returns only the command table rows.
- def render_partial(options)
- pattern = partial_pattern options[:partial]
- filename = Dir[pattern].first
- raise "Partial '#{partial_path}' cannot be found! (Looking for file: '#{pattern}')" unless filename
- partial = render :file => filename, :use_full_path => false, :locals => options[:locals]
- extract_commands_from_partial partial
- end
-
- # Extracts the commands from a partial. The partial must contain a html table
- # and the first row is ignored since it cannot contain a command.
- def extract_commands_from_partial partial
- partial = partial.match(/.*.*?.*?<\/tr>(.*?)<\/table>/im)[1]
- raise "Partial '#{name}' doesn't contain any table" unless partial
- partial
- end
-
- private
- # Generates the file pattern from the provided partial path.
- # The starting _ and file extension don't have too be provided.
- def partial_pattern partial_path
- path = partial_path.split '/'
- filename = path.delete_at(-1)
- filename = '_' + filename unless filename.starts_with? '_'
- filename << '.*' unless filename.include? '.'
- pattern = selenium_tests_path + '/'
- pattern << path.join('/') + '/' if path
- pattern << filename
- end
-
-end
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/paths.rb b/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/paths.rb
deleted file mode 100644
index 5910ec43..00000000
--- a/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/paths.rb
+++ /dev/null
@@ -1,61 +0,0 @@
-require 'selenium_on_rails_config'
-
-module SeleniumOnRails
- module Paths
-
- def selenium_path
- @@selenium_path ||= find_selenium_path
- @@selenium_path
- end
-
- def selenium_tests_path
- return SeleniumOnRailsConfig.get("selenium_tests_path") if SeleniumOnRailsConfig.get("selenium_tests_path")
- File.expand_path(File.join(RAILS_ROOT, 'test/selenium'))
- end
-
- def view_path view
- File.expand_path(File.dirname(__FILE__) + '/../views/' + view)
- end
-
- # Returns the path to the layout template. The path is relative in relation
- # to the app/views/ directory since Rails doesn't support absolute paths
- # to layout templates.
- def layout_path
- 'layout.rhtml'
- end
-
- def fixtures_path
- return SeleniumOnRailsConfig.get("fixtures_path") if SeleniumOnRailsConfig.get("fixtures_path")
- File.expand_path File.join(RAILS_ROOT, 'test/fixtures')
- end
-
- def log_path log_file
- File.expand_path(File.dirname(__FILE__) + '/../../log/' + File.basename(log_file))
- end
-
- def skip_file? file
- file.split('/').each do |f|
- return true if f.upcase == 'CVS' or f.starts_with?('.') or f.ends_with?('~') or f.starts_with?('_')
- end
- false
- end
-
- private ###############################################
-
- def find_selenium_path
- sel_dirs = SeleniumOnRailsConfig.get :selenium_path do
- File.expand_path(File.dirname(__FILE__) + '/../../selenium-core')
- end
-
- sel_dirs.to_a.each do |seleniumdir|
- ['', 'core', 'selenium', 'javascript'].each do |subdir|
- path = File.join seleniumdir, subdir
- return path if File.exist?(File.join(path, 'TestRunner.html'))
- end
- end
-
- raise 'Could not find Selenium Core installation'
- end
-
- end
-end
diff --git a/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/renderer.rb b/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/renderer.rb
deleted file mode 100644
index 76b770eb..00000000
--- a/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/renderer.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-module SeleniumOnRails::Renderer
- include SeleniumOnRails::Paths
-
- def render_test_case filename
- @template.extend SeleniumOnRails::PartialsSupport
- @page_title = test_case_name filename
- output = render_to_string :file => filename, :locals => {"page_title" => @page_title}
- layout = (output =~ //i ? false : layout_path)
- render :text => output, :layout => layout
-
- headers['Cache-control'] = 'no-cache'
- headers['Pragma'] = 'no-cache'
- headers['Expires'] = '-1'
- end
-
- def test_case_name filename
- File.basename(filename).sub(/\..*/,'').humanize
- end
-
-end
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/rselenese.rb b/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/rselenese.rb
deleted file mode 100644
index cc297f0f..00000000
--- a/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/rselenese.rb
+++ /dev/null
@@ -1,44 +0,0 @@
-# Renders Selenium test templates in a fashion analogous to +rxml+ and
-# +rjs+ templates.
-#
-# setup
-# open :controller => 'customer', :action => 'list'
-# assert_title 'Customers'
-#
-# See SeleniumOnRails::TestBuilder for a list of available commands.
-class SeleniumOnRails::RSelenese < SeleniumOnRails::TestBuilder
-end
-ActionView::Template.register_template_handler 'rsel', SeleniumOnRails::RSelenese
-
-class SeleniumOnRails::RSelenese
- attr_accessor :view
-
- def initialize view
- super view
- @view = view
- end
-
- def render template, local_assigns = {}
- title = (@view.assigns['page_title'] or local_assigns['page_title'])
-
- evaluator = Evaluator.new(@view)
- evaluator.run_script title, assign_locals_code_from(local_assigns) + "\n" + template.source, local_assigns
- end
-
- def assign_locals_code_from(local_assigns)
- return local_assigns.keys.collect {|key| "#{key} = local_assigns[#{key.inspect}];"}.join
- end
-
- def self.call(template)
- "#{name}.new(self).render(template, local_assigns)"
- end
-
- class Evaluator < SeleniumOnRails::TestBuilder
- def run_script(title, script, local_assigns)
- table(title) do
- test = self #to enable test.command
- eval script
- end
- end
- end
-end
diff --git a/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/selenese.rb b/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/selenese.rb
deleted file mode 100644
index d65a8df6..00000000
--- a/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/selenese.rb
+++ /dev/null
@@ -1,87 +0,0 @@
-require 'selenium_on_rails/partials_support'
-
-class SeleniumOnRails::Selenese
-end
-ActionView::Template.register_template_handler 'sel', SeleniumOnRails::Selenese
-
-
-class SeleniumOnRails::Selenese
- def initialize view
- @view = view
- end
-
- def render template, local_assigns = {}
- name = (@view.assigns['page_title'] or local_assigns['page_title'])
- lines = template.source.strip.split "\n"
- html = ''
- html << extract_comments(lines)
- html << extract_commands(lines, name)
- html << extract_comments(lines)
- raise 'You cannot have comments in the middle of commands!' if next_line lines, :any
- html
- end
-
- private
- def next_line lines, expects
- while lines.any?
- l = lines.shift.strip
- next if (l.empty? and expects != :comment)
- comment = (l =~ /^\|.*\|$/).nil?
- if (comment and expects == :command) or (!comment and expects == :comment)
- lines.unshift l
- return nil
- end
- return l
- end
- end
-
- def self.call(template)
- "#{name}.new(self).render(template, local_assigns)"
- end
-
- def extract_comments lines
- comments = ''
- while (line = next_line lines, :comment)
- comments << line + "\n"
- end
- if defined? RedCloth
- comments = RedCloth.new(comments).to_html
- end
- comments += "\n" unless comments.empty?
- comments
- end
-
- def extract_commands lines, name
- html = "\n| #{name} |
\n"
- while (line = next_line lines, :command)
- line = line[1..-2] #remove starting and ending |
- cells = line.split '|'
- if cells.first == 'includePartial'
- html << include_partial(cells[1..-1])
- next
- end
- raise 'There might only be a maximum of three cells!' if cells.length > 3
- html << ''
- (1..3).each do
- cell = cells.shift
- cell = (cell ? CGI.escapeHTML(cell.strip) : ' ')
- html << "| #{cell} | "
- end
- html << "
\n"
- end
- html << "
\n"
- end
-
- def include_partial params
- partial = params.shift
- locals = {}
- params.each do |assignment|
- next if assignment.empty?
- _, var, value = assignment.split(/^([a-z_][a-zA-Z0-9_]*)\s*=\s*(.*)$/)
- raise "Invalid format '#{assignment}'. Should be '|includePartial|partial|var1=value|var2=value|." unless var
- locals[var.to_sym] = value or ''
- end
- @view.render :partial => partial, :locals => locals
- end
-
-end
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/suite_renderer.rb b/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/suite_renderer.rb
deleted file mode 100644
index 0774e841..00000000
--- a/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/suite_renderer.rb
+++ /dev/null
@@ -1,56 +0,0 @@
-require 'selenium_on_rails'
-
-module SeleniumOnRails
- module SuiteRenderer
- def test_suite_name path
- return 'All test cases' if [nil, '/'].include? path_to_relative_url(path)
- File.split(path)[-1].humanize
- end
-
- def test_suites path
- suites = []
-
- parent_path = File.join(File.split(path).slice(0..-2)) #all but last
- parent_path = path_to_relative_url parent_path
- suites << ['..', parent_path] unless parent_path.nil?
-
- visit_all_tests path, '', Proc.new {|n, p| suites << [n,path_to_relative_url(p)]}, nil
- suites
- end
-
- def test_cases path
- tests = []
- visit_all_tests path, '', nil, Proc.new {|n, p| tests << [n,p]}
- tests
- end
-
- def link_to_test_case suite_name, filename
- name = suite_name + test_case_name(filename)
- link_to name, :action => :test_file, :testname => path_to_relative_url(filename).sub(/^\//,'')
- end
-
- private ###############################################
-
- def path_to_relative_url path
- slt = @controller.selenium_tests_path
- return nil unless path.index slt
- path.sub slt, ''
- end
-
- def visit_all_tests path, suite_name, suite_consumer, test_consumer
- dirs = [] #add dirs to an array in order for files to be processed before dirs
- Dir.entries(path).sort.each do |e|
- next if skip_file?(e) or ['.','..'].include?(e)
- filename = File.join path, e
- if File.directory? filename
- dirs << [filename, "#{suite_name}#{e.humanize}."]
- suite_consumer.call("#{suite_name}#{e.humanize}", filename) if suite_consumer
- else
- test_consumer.call(suite_name, filename) if test_consumer
- end
- end
- #recurse through dirs
- dirs.each {|p, n| visit_all_tests p, n, suite_consumer, test_consumer }
- end
- end
-end
diff --git a/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/test_builder.rb b/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/test_builder.rb
deleted file mode 100644
index 53f7e7aa..00000000
--- a/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/test_builder.rb
+++ /dev/null
@@ -1,116 +0,0 @@
-require 'selenium_on_rails/test_builder_actions'
-require 'selenium_on_rails/test_builder_accessors'
-
-# Create test_builder_user_actions.rb to support actions included
-# in selenium-core's user-extensions.js
-#
-# See test_builder_user_actions.rb.example for examples matching
-# selenium-core's user-extensions.js.sample
-module SeleniumOnRails::TestBuilderUserActions
-end
-require 'selenium_on_rails/test_builder_user_actions' if File.exist?(File.expand_path(File.join(File.dirname(__FILE__), 'test_builder_user_actions.rb')))
-
-
-# Create test_builder_user_accessors.rb to support accessors
-# included in selenium-core's user-extensions.js
-#
-# See test_builder_user_accessors.rb.example for examples matching
-# selenium-core's user-extensions.js.sample
-module SeleniumOnRails::TestBuilderUserAccessors
-end
-require 'selenium_on_rails/test_builder_user_accessors' if File.exist?(File.expand_path(File.join(File.dirname(__FILE__), 'test_builder_user_accessors.rb')))
-
-# Builds Selenium test table using a high-level Ruby interface. Normally
-# invoked through SeleniumOnRails::RSelenese.
-#
-# See SeleniumOnRails::TestBuilderActions for the available actions and
-# SeleniumOnRails::TestBuilderAccessors for the available checks.
-#
-# For more information on the commands supported by TestBuilder, see the
-# Selenium Commands Documentation at
-# http://release.openqa.org/selenium-core/nightly/reference.html.
-class SeleniumOnRails::TestBuilder
- include SeleniumOnRails::TestBuilderActions
- include SeleniumOnRails::TestBuilderAccessors
- include SeleniumOnRails::TestBuilderUserActions
- include SeleniumOnRails::TestBuilderUserAccessors
-
- # Convert _str_ to a Selenium command name.
- def self.selenize str
- str.camelize.gsub(/^[A-Z]/) {|s| s.downcase }
- end
-
- # Prepends _pattern_ with 'exact:' if it would be considered containing
- # string-match pattern otherwise.
- def exactize pattern
- pattern.include?(':') ? "exact:#{pattern}" : pattern
- end
-
- # Create a new TestBuilder for _view_.
- def initialize view
- @view = view
- @output = ''
- @xml = Builder::XmlMarkup.new :indent => 2, :target => @output
- end
-
- # Add a new table of tests, and return the HTML.
- def table title
- @xml.table do
- @xml.tr do @xml.th(title, :colspan => 3) end
- yield self
- end
- end
-
- # Add a new test command using _cmd_, _target_ and _value_.
- def command cmd, target=nil, value=nil
- @xml.tr do
- _tdata cmd
- _tdata target
- _tdata value
- end
- end
- # :nodoc
- alias_method :command_verbatim, :command
-
- # Same as _command_ but add _AndWait_ to the name of _cmd_.
- def command_and_wait cmd, target=nil, value=nil
- command_verbatim cmd.to_s + 'AndWait', target, value
- end
-
- # Re routes commands in the provided block to #command_and_wait instead of
- # #command.
- def make_command_waiting
- self.class.send :alias_method, :command, :command_and_wait
- yield
- self.class.send :alias_method, :command, :command_verbatim
- end
-
-protected
-
- # If _url_ is a string, return unchanged. Otherwise, pass it to
- # ActionView#UrlHelper#url_for.
- def url_arg url
- if url.instance_of?(String) then url else exactize(@view.url_for(url)) end
- end
-
- # If _arg_ is an array formats _arg_ to a textual representation.
- # Otherwise return unchanged.
- def collection_arg arg
- if arg.is_a? Array
- arg.collect {|e| e.gsub(/[\\,]/) {|s| "\\#{s}" } }.join(',')
- else
- arg
- end
- end
-
-private
-
- # Output a single TD element.
- def _tdata value
- if value
- @xml.td(value.to_s)
- else
- @xml.td do @xml.target! << ' ' end
- end
- end
-end
diff --git a/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/test_builder_accessors.rb b/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/test_builder_accessors.rb
deleted file mode 100644
index ccd09fb3..00000000
--- a/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/test_builder_accessors.rb
+++ /dev/null
@@ -1,1002 +0,0 @@
-# The accessors available for SeleniumOnRails::TestBuilder tests.
-#
-# For each +store_foo+ there's +assert_foo+, +assert_not_foo+, +verify_foo+,
-# +verify_not_foo+, +wait_for_foo+, +wait_for_not_foo+.
-module SeleniumOnRails::TestBuilderAccessors
-
- # Tell Selenium to expect an error on the next command execution.
- #
- # NOTE: store_error_on_next is currently not supported by
- # Selenium Core and is only added to here as a shortcut for
- # generating the related assertions.
- #
- # Related Assertions, automatically generated:
- # * assert_error_on_next(message)
- # * assert_not_error_on_next(message)
- # * verify_error_on_next(message)
- # * verify_not_error_on_next(message)
- # * wait_for_error_on_next(message)
- # * wait_for_not_error_on_next(message)
- def store_error_on_next message
- raise 'Not supported in Selenium Core at the moment'
- end
-
- # Tell Selenium to expect a failure on the next command execution.
- #
- # NOTE: store_failure_on_next is currently not supported by
- # Selenium Core and is only added to here as a shortcut for
- # generating the related assertions.
- #
- # Related Assertions, automatically generated:
- # * assert_failure_on_next(message)
- # * assert_not_failure_on_next(message)
- # * verify_failure_on_next(message)
- # * verify_not_failure_on_next(message)
- # * wait_for_failure_on_next(message)
- # * wait_for_not_failure_on_next(message)
- def store_failure_on_next message
- raise 'Not supported in Selenium Core at the moment'
- end
-
- # Returns the IDs of all windows that the browser knows about.
- #
- # Related Assertions, automatically generated:
- # * assertAllWindowIds(pattern)
- # * assertNotAllWindowIds(pattern)
- # * verifyAllWindowIds(pattern)
- # * verifyNotAllWindowIds(pattern)
- # * waitForAllWindowIds(pattern)
- # * waitForNotAllWindowIds(pattern)
- def store_all_window_ids variable_name
- command 'storeAllWindowIds', variable_name
- end
-
- # Returns the names of all windows that the browser knows about.
- #
- # Related Assertions, automatically generated:
- # * assertAllWindowNames(pattern)
- # * assertNotAllWindowNames(pattern)
- # * verifyAllWindowNames(pattern)
- # * verifyNotAllWindowNames(pattern)
- # * waitForAllWindowNames(pattern)
- # * waitForNotAllWindowNames(pattern)
- def store_all_window_names variable_name
- command 'storeAllWindowNames', variable_name
- end
-
- # Returns the titles of all windows that the browser knows about.
- #
- # Related Assertions, automatically generated:
- # * assertAllWindowTitles(pattern)
- # * assertNotAllWindowTitles(pattern)
- # * verifyAllWindowTitles(pattern)
- # * verifyNotAllWindowTitles(pattern)
- # * waitForAllWindowTitles(pattern)
- # * waitForNotAllWindowTitles(pattern)
- def store_all_window_titles variable_name
- command 'storeAllWindowTitles', variable_name
- end
-
- # Has an alert occurred?
- #
- # Related Assertions, automatically generated:
- # * assert_alert_present
- # * assert_alert_not_present
- # * verify_alert_present
- # * verify_alert_not_present
- # * wait_for_alert_present
- # * wait_for_alert_not_present
- def store_alert_present variable_name
- command 'storeAlertPresent', variable_name
- end
-
- # Returns every instance of some attribute from all known windows.
- #
- # Related Assertions, automatically generated:
- # * assert_attribute_from_all_windows(attribute_name, pattern)
- # * assert_not_attribute_from_all_windows(attribute_name, pattern)
- # * verify_attribute_from_all_windows(attribute_name, pattern)
- # * verify_not_attribute_from_all_windows(attribute_name, pattern)
- # * wait_for_attribute_from_all_windows(attribute_name, pattern)
- # * wait_for_not_attribute_from_all_windows(attribute_name, pattern)
- def store_attribute_from_all_windows attribute_name, variable_name
- command 'storeAttributeFromAllWindows', attribute_name, variable_name
- end
-
- # Has a prompt occurred?
- #
- # Related Assertions, automatically generated:
- # * assert_prompt_present
- # * assert_prompt_not_present
- # * verify_prompt_present
- # * verify_prompt_not_present
- # * wait_for_prompt_present
- # * wait_for_prompt_not_present
- def store_prompt_present variable_name
- command 'storePromptPresent', variable_name
- end
-
- # Has confirm() been called?
- #
- # Related Assertions, automatically generated:
- # * assert_confirmation_present
- # * assert_confirmation_not_present
- # * verify_confirmation_present
- # * verify_confirmation_not_present
- # * wait_for_confirmation_present
- # * wait_for_confirmation_not_present
- def store_confirmation_present variable_name
- command 'storeConfirmationPresent', variable_name
- end
-
- # Return all cookies of the current page under test.
- #
- # Related Assertions, automatically generated:
- # * assert_cookie(pattern)
- # * assert_not_cookie(pattern)
- # * verify_cookie(pattern)
- # * verify_not_cookie(pattern)
- # * wait_for_cookie(pattern)
- # * wait_for_not_cookie(pattern)
- def store_cookie variable_name
- command 'storeCookie', variable_name
- end
-
- # Retrieves the text cursor position in the given input element or
- # textarea; beware, this may not work perfectly on all browsers.
- #
- # This method will fail if the specified element isn't an input element
- # or textarea, or there is no cursor in the element.
- #
- # Related Assertions, automatically generated:
- # * assert_cursor_position(locator, pattern)
- # * assert_not_cursor_position(locator, pattern)
- # * verify_cursor_position(locator, pattern)
- # * verify_not_cursor_position(locator, pattern)
- # * wait_for_cursor_position(locator, pattern)
- # * wait_for_not_cursor_position(locator, pattern)
- def store_cursor_position locator, variable_name
- command 'storeCursorPosition', locator, variable_name
- end
-
- # Retrieves the message of a JavaScript alert generated during the previous
- # action, or fail if there were no alerts.
- #
- # Getting an alert has the same effect as manually clicking OK. If an alert
- # is generated but you do not get/verify it, the next Selenium action will
- # fail.
- #
- # NOTE: under Selenium, JavaScript alerts will NOT pop up a visible alert
- # dialog.
- #
- # NOTE: Selenium does NOT support JavaScript alerts that are generated in a
- # page's onload() event handler. In this case a visible dialog WILL be
- # generated and Selenium will hang until someone manually clicks OK.
- #
- # Related Assertions, automatically generated:
- # * assert_alert(pattern)
- # * assert_not_alert(pattern)
- # * verify_alert_present(pattern)
- # * verify_not_alert(pattern)
- # * wait_for_alert(pattern)
- # * wait_for_not_alert(pattern)
- def store_alert variable_name
- command 'storeAlert', variable_name
- end
-
- # Retrieves the message of a JavaScript confirmation dialog generated during
- # the previous action.
- #
- # By default, the confirm function will return +true+, having the same effect
- # as manually clicking OK. This can be changed by prior execution of the
- # +choose_cancel_on_next_confirmation+ command. If a confirmation is
- # generated but you do not get/verify it, the next Selenium action will fail.
- #
- # NOTE: under Selenium, JavaScript confirmations will NOT pop up a visible
- # dialog.
- #
- # NOTE: Selenium does NOT support JavaScript confirmations that are generated
- # in a page's onload() event handler. In this case a visible dialog WILL be
- # generated and Selenium will hang until you manually click OK.
- #
- # Related Assertions, automatically generated:
- # * assert_confirmation(pattern)
- # * assert_not_confirmation(pattern)
- # * verify_confirmation_present(pattern)
- # * verify_not_confirmation(pattern)
- # * wait_for_confirmation(pattern)
- # * wait_for_not_confirmation(pattern)
- def store_confirmation variable_name
- command 'storeConfirmation', variable_name
- end
-
- # Retrieves the message of a JavaScript question prompt dialog generated
- # during the previous action.
- #
- # Successful handling of the prompt requires prior execution of the
- # +answer_on_next_prompt+ command. If a prompt is generated but you do not
- # get/verify it, the next Selenium action will fail.
- #
- # NOTE: under Selenium, JavaScript prompts will NOT pop up a visible dialog.
- #
- # NOTE: Selenium does NOT support JavaScript prompts that are generated in a
- # page's onload() event handler. In this case a visible dialog WILL be
- # generated and Selenium will hang until someone manually clicks OK.
- #
- # Related Assertions, automatically generated:
- # * assert_prompt(pattern)
- # * assert_not_prompt(pattern)
- # * verify_prompt_present(pattern)
- # * verify_not_prompt(pattern)
- # * wait_for_prompt(pattern)
- # * wait_for_not_prompt(pattern)
- def store_prompt variable_name
- command 'storePrompt', variable_name
- end
-
- # Gets the absolute URL of the current page.
- #
- # Related Assertions, automatically generated:
- # * assert_absolute_location(pattern)
- # * assert_not_absolute_location(pattern)
- # * verify_absolute_location_present(pattern)
- # * verify_not_absolute_location(pattern)
- # * wait_for_absolute_location(pattern)
- # * wait_for_not_absolute_location(pattern)
- def store_absolute_location variable_name
- command 'storeAbsoluteLocation', variable_name
- end
-
- # Verify the location of the current page ends with the expected location.
- # If an URL querystring is provided, this is checked as well.
- #
- # Related Assertions, automatically generated:
- # * assert_location(pattern)
- # * assert_not_location(pattern)
- # * verify_location_present(pattern)
- # * verify_not_location(pattern)
- # * wait_for_location(pattern)
- # * wait_for_not_location(pattern)
- def store_location expected_location, variable_name
- command 'storeLocation', expected_location, variable_name
- end
-
- # Returns the number of pixels between "mousemove" events during
- # drag_and_drop commands (default=10).
- #
- # Related Assertions, automatically generated:
- # * assert_mouse_speed(pattern)
- # * assert_not_mouse_speed(pattern)
- # * verify_mouse_speed(pattern)
- # * verify_not_mouse_speed(pattern)
- # * wait_for_mouse_speed(pattern)
- # * wait_for_not_mouse_speed(pattern)
- def store_mouse_speed variable_name
- command 'storeMouseSpeed', variable_name
- end
-
- # Gets the title of the current page.
- #
- # Related Assertions, automatically generated:
- # * assert_title(pattern)
- # * assert_not_title(pattern)
- # * verify_title_present(pattern)
- # * verify_not_title(pattern)
- # * wait_for_title(pattern)
- # * wait_for_not_title(pattern)
- def store_title variable_name
- command 'storeTitle', variable_name
- end
-
- # Gets the entire text of the page.
- #
- # Related Assertions, automatically generated:
- # * assert_body_text(pattern)
- # * assert_not_body_text(pattern)
- # * verify_body_text_present(pattern)
- # * verify_not_body_text(pattern)
- # * wait_for_body_text(pattern)
- # * wait_for_not_body_text(pattern)
- def store_body_text variable_name
- command 'storeBodyText', variable_name
- end
-
- # Gets the (whitespace-trimmed) value of an input field (or anything else
- # with a value parameter). For checkbox/radio elements, the value will be
- # "on" or "off" depending on whether the element is checked or not.
- #
- # Related Assertions, automatically generated:
- # * assert_value(locator, pattern)
- # * assert_not_value(locator, pattern)
- # * verify_value_present(locator, pattern)
- # * verify_not_value(locator, pattern)
- # * wait_for_value(locator, pattern)
- # * wait_for_not_value(locator, pattern)
- def store_value locator, variable_name
- command 'storeValue', locator, variable_name
- end
-
- # Gets the text of an element. This works for any element that contains text.
- # This command uses either the +textContent+ (Mozilla-like browsers) or the
- # +innerText+ (IE-like browsers) of the element, which is the rendered text
- # shown to the user.
- #
- # Related Assertions, automatically generated:
- # * assert_text(locator, pattern)
- # * assert_not_text(locator, pattern)
- # * verify_text_present(locator, pattern)
- # * verify_not_text(locator, pattern)
- # * wait_for_text(locator, pattern)
- # * wait_for_not_text(locator, pattern)
- def store_text locator, variable_name
- command 'storeText', locator, variable_name
- end
-
- # Gets the result of evaluating the specified JavaScript snippet. The snippet
- # may have multiple lines, but only the result of the last line will be
- # returned.
- #
- # Note that, by default, the snippet will run in the context of the
- # "selenium" object itself, so +this+ will refer to the Selenium object, and
- # +window+ will refer to the top-level runner test window, not the window of
- # your application.
- #
- # If you need a reference to the window of your application, you can refer to
- # this.browserbot.getCurrentWindow() and if you need to use a locator to
- # refer to a single element in your application page, you can use
- # this.page().findElement("foo") where "foo" is your locator.
- #
- # Related Assertions, automatically generated:
- # * assert_eval(script, pattern)
- # * assert_not_eval(script, pattern)
- # * verify_eval_present(script, pattern)
- # * verify_not_eval(script, pattern)
- # * wait_for_eval(script, pattern)
- # * wait_for_not_eval(script, pattern)
- def store_eval script, variable_name
- command 'storeEval', script, variable_name
- end
-
- # Gets whether a toggle-button (checkbox/radio) is checked. Fails if the
- # specified element doesn't exist or isn't a toggle-button.
- #
- # Related Assertions, automatically generated:
- # * assert_checked(locator)
- # * assert_not_checked(locator)
- # * verify_checked_present(locator)
- # * verify_not_checked(locator)
- # * wait_for_checked(locator)
- # * wait_for_not_checked(locator)
- def store_checked locator, variable_name
- command 'storeChecked', locator, variable_name
- end
-
- # Gets the text from a cell of a table.
- #
- # Related Assertions, automatically generated:
- # * assert_table(locator, row, column, pattern)
- # * assert_not_table(locator, row, column, pattern)
- # * verify_table_present(locator, row, column, pattern)
- # * verify_not_table(locator, row, column, pattern)
- # * wait_for_table(locator, row, column, pattern)
- # * wait_for_not_table(locator, row, column, pattern)
- def store_table locator, row, column, variable_name
- command 'storeTable', "#{locator}.#{row}.#{column}", variable_name
- end
-
- # Verifies that the selected option of a drop-down satisfies the
- # option_locator.
- #
- # option_locator is typically just an option label (e.g. "John Smith").
- #
- # See the select command for more information about option locators.
- #
- # NOTE: store_selected is currently not supported by Selenium Core.
- #
- # Related Assertions, automatically generated:
- # * assert_selected(locator, option_locator)
- # * assert_not_selected(locator, option_locator)
- # * verify_selected_present(locator, option_locator)
- # * verify_not_selected(locator, option_locator)
- # * wait_for_selected(locator, option_locator)
- # * wait_for_not_selected(locator, option_locator)
- def store_selected locator, option_locator, variable_name
- raise 'Not supported in Selenium Core at the moment'
- end
-
- # Gets option element ID for selected option in the specified select element.
- #
- # Related Assertions, automatically generated:
- # * assert_selected_id(select_locator, pattern)
- # * assert_not_selected_id(select_locator, pattern)
- # * verify_selected_id(select_locator, pattern)
- # * verify_not_selected_id(select_locator, pattern)
- # * wait_for_selected_id(select_locator, pattern)
- # * wait_for_not_selected_id(select_locator, pattern)
- def store_selected_id select_locator, variable_name
- command 'storeSelectedId', select_locator, variable_name
- end
-
- # Gets all option element IDs for selected options in the specified select
- # or multi-select element.
- #
- # Related Assertions, automatically generated:
- # * assert_selected_ids(select_locator, pattern)
- # * assert_not_selected_ids(select_locator, pattern)
- # * verify_selected_ids(select_locator, pattern)
- # * verify_not_selected_ids(select_locator, pattern)
- # * wait_for_selected_ids(select_locator, pattern)
- # * wait_for_not_selected_ids(select_locator, pattern)
- def store_selected_ids select_locator, variable_name
- command 'storeSelectedIds', select_locator, variable_name
- end
-
- # Gets option index (option number, starting at 0) for selected option in the
- # specified select element.
- #
- # Related Assertions, automatically generated:
- # * assert_selected_index(select_locator, pattern)
- # * assert_not_selected_index(select_locator, pattern)
- # * verify_selected_index(select_locator, pattern)
- # * verify_not_selected_index(select_locator, pattern)
- # * wait_for_selected_index(select_locator, pattern)
- # * wait_for_not_selected_index(select_locator, pattern)
- def store_selected_index select_locator, variable_name
- command 'storeSelectedIndex', select_locator, variable_name
- end
-
- # Gets all option indexes (option number, starting at 0) for selected options
- # in the specified select or multi-select element.
- #
- # Related Assertions, automatically generated:
- # * assert_selected_indexes(select_locator, pattern)
- # * assert_not_selected_indexes(select_locator, pattern)
- # * verify_selected_indexes(select_locator, pattern)
- # * verify_not_selected_indexes(select_locator, pattern)
- # * wait_for_selected_indexes(select_locator, pattern)
- # * wait_for_not_selected_indexes(select_locator, pattern)
- def store_selected_indexes select_locator, variable_name
- command 'storeSelectedIndexes', select_locator, variable_name
- end
-
- # Gets option label (visible text) for selected option in the specified select
- # element.
- #
- # Related Assertions, automatically generated:
- # * assert_selected_label(select_locator, pattern)
- # * assert_not_selected_label(select_locator, pattern)
- # * verify_selected_label(select_locator, pattern)
- # * verify_not_selected_label(select_locator, pattern)
- # * wait_for_selected_label(select_locator, pattern)
- # * wait_for_not_selected_label(select_locator, pattern)
- def store_selected_label select_locator, variable_name
- command 'storeSelectedLabel', select_locator, variable_name
- end
-
- # Gets all option labels (visible text) for selected options in the specified
- # select or multi-select element.
- #
- # Related Assertions, automatically generated:
- # * assert_selected_labels(select_locator, pattern)
- # * assert_not_selected_labels(select_locator, pattern)
- # * verify_selected_labels(select_locator, pattern)
- # * verify_not_selected_labels(select_locator, pattern)
- # * wait_for_selected_labels(select_locator, pattern)
- # * wait_for_not_selected_labels(select_locator, pattern)
- def store_selected_labels select_locator, variable_name
- command 'storeSelectedLabels', select_locator, variable_name
- end
-
- # Gets option value (value attribute) for selected option in the specified
- # select element.
- #
- # Related Assertions, automatically generated:
- # * assert_selected_value(select_locator, pattern)
- # * assert_not_selected_value(select_locator, pattern)
- # * verify_selected_value(select_locator, pattern)
- # * verify_not_selected_value(select_locator, pattern)
- # * wait_for_selected_value(select_locator, pattern)
- # * wait_for_not_selected_value(select_locator, pattern)
- def store_selected_value select_locator, variable_name
- command 'storeSelectedValue', select_locator, variable_name
- end
-
- # Gets all option values (value attribute) for selected options in the specified
- # select or multi-select element.
- #
- # Related Assertions, automatically generated:
- # * assert_selected_values(select_locator, pattern)
- # * assert_not_selected_values(select_locator, pattern)
- # * verify_selected_values(select_locator, pattern)
- # * verify_not_selected_values(select_locator, pattern)
- # * wait_for_selected_values(select_locator, pattern)
- # * wait_for_not_selected_values(select_locator, pattern)
- def store_selected_values select_locator, variable_name
- command 'storeSelectedValues', select_locator, variable_name
- end
-
- # Determines whether some option in a drop-down menu is selected.
- #
- # Related Assertions, automatically generated:
- # * assert_something_selected(select_locator)
- # * assert_not_something_selected(select_locator)
- # * verify_something_selected(select_locator)
- # * verify_not_something_selected(select_locator)
- # * wait_for_something_selected(select_locator)
- # * wait_for_not_something_selected(select_locator)
- def store_something_selected select_locator, variable_name
- command 'storeSomethingSelected', select_locator, variable_name
- end
-
- # Gets all option labels for selected options in the specified select or
- # multi-select element.
- #
- # The +pattern+ for the automatically generated assertions can either take an
- # array or a pattern.
- # assert_selected_options 'fruits', ['apple', 'pear']
- # assert_selected_options 'fruits', 'a*,p*'
- #
- # Related Assertions, automatically generated:
- # * assert_selected_options(locator, pattern)
- # * assert_not_selected_options(locator, pattern)
- # * verify_selected_options_present(locator, pattern)
- # * verify_not_selected_options(locator, pattern)
- # * wait_for_selected_options(locator, pattern)
- # * wait_for_not_selected_options(locator, pattern)
- def store_selected_options locator, variable_name
- command 'storeSelectedOptions', locator, variable_name
- end
-
- # Gets all option labels in the specified select drop-down.
- #
- # The +pattern+ for the automatically generated assertions can either take an
- # array or a pattern.
- # assert_select_options 'fruits', ['apple', 'pear']
- # assert_select_options 'fruits', 'a*,p*'
- #
- # Related Assertions, automatically generated:
- # * assert_select_options(locator, pattern)
- # * assert_not_select_options(locator, pattern)
- # * verify_select_options_present(locator, pattern)
- # * verify_not_select_options(locator, pattern)
- # * wait_for_select_options(locator, pattern)
- # * wait_for_not_select_options(locator, pattern)
- def store_select_options locator, variable_name
- command 'storeSelectOptions', locator, variable_name
- end
-
- # Gets the value of an element attribute.
- #
- # Related Assertions, automatically generated:
- # * assert_attribute(locator, attribute_name, pattern)
- # * assert_not_attribute(locator, attribute_name, pattern)
- # * verify_attribute_present(locator, attribute_name, pattern)
- # * verify_not_attribute(locator, attribute_name, pattern)
- # * wait_for_attribute(locator, attribute_name, pattern)
- # * wait_for_not_attribute(locator, attribute_name, pattern)
- def store_attribute locator, attribute_name, variable_name
- command 'storeAttribute', "#{locator}@#{attribute_name}", variable_name
- end
-
- # Check if these two elements have same parent and are ordered. Two
- # same elements will not be considered ordered.
- #
- # NOTE: store_ordered is currently not supported by Selenium Core.
- #
- # Related Assertions, automatically generated:
- # * assert_ordered(locator_1, locator_2)
- # * assert_not_ordered(locator_1, locator_2)
- # * verify_ordered(locator_1, locator_2)
- # * verify_not_ordered(locator_1, locator_2)
- # * wait_for_ordered(locator_1, locator_2)
- # * wait_for_not_ordered(locator_1, locator_2)
- def store_ordered locator_1, locator_2, variable_name
- raise 'Not supported in Selenium Core at the moment'
- end
-
- # Verifies that the specified text pattern appears somewhere on the rendered
- # page shown to the user.
- #
- # Related Assertions, automatically generated:
- # * assert_text_present(pattern)
- # * assert_text_not_present(pattern)
- # * verify_text_present(pattern)
- # * verify_text_not_present(pattern)
- # * wait_for_text_present(pattern)
- # * wait_for_text_not_present(pattern)
- def store_text_present pattern, variable_name
- command 'storeTextPresent', pattern, variable_name
- end
-
- # Verifies that the specified element is somewhere on the page.
- #
- # Related Assertions, automatically generated:
- # * assert_element_present(locator)
- # * assert_element_not_present(locator)
- # * verify_element_present(locator)
- # * verify_element_not_present(locator)
- # * wait_for_element_present(locator)
- # * wait_for_element_not_present(locator)
- def store_element_present locator, variable_name
- command 'storeElementPresent', locator, variable_name
- end
-
- # Determines if the specified element is visible. An element can be rendered
- # invisible by setting the CSS "visibility" property to "hidden", or the
- # "display" property to "none", either for the element itself or one if its
- # ancestors. This method will fail if the element is not present.
- #
- # Related Assertions, automatically generated:
- # * assert_visible(locator)
- # * assert_not_visible(locator)
- # * verify_visible(locator)
- # * verify_not_visible(locator)
- # * wait_for_visible(locator)
- # * wait_for_not_visible(locator)
- def store_visible locator, variable_name
- command 'storeVisible', locator, variable_name
- end
-
- # Retrieves the height of an element. This method will fail if the element
- # is not present.
- #
- # Related Assertions, automatically generated:
- # * assert_element_height(locator, pattern)
- # * assert_not_element_height(locator, pattern)
- # * verify_element_height(locator, pattern)
- # * verify_not_element_height(locator, pattern)
- # * wait_for_element_height(locator, pattern)
- # * wait_for_not_element_height(locator, pattern)
- def store_element_height locator, variable_name
- command 'storeElementHeight', locator, variable_name
- end
-
- # Get the relative index of an element to its parent (starting from 0).
- # The comment node and empty text node will be ignored.
- #
- # Related Assertions, automatically generated:
- # * assert_element_index(locator, pattern)
- # * assert_not_element_index(locator, pattern)
- # * verify_element_index(locator, pattern)
- # * verify_not_element_index(locator, pattern)
- # * wait_for_element_index(locator, pattern)
- # * wait_for_not_element_index(locator, pattern)
- def store_element_index locator, variable_name
- command 'storeElementIndex', locator, variable_name
- end
-
- # Retrieves the width of an element. This method will fail if the element
- # is not present.
- #
- # Related Assertions, automatically generated:
- # * assert_element_width(locator, pattern)
- # * assert_not_element_width(locator, pattern)
- # * verify_element_width(locator, pattern)
- # * verify_not_element_width(locator, pattern)
- # * wait_for_element_width(locator, pattern)
- # * wait_for_not_element_width(locator, pattern)
- def store_element_width locator, variable_name
- command 'storeElementWidth', locator, variable_name
- end
-
- # Retrieves the horizontal position of an element. This method will fail
- # if the element is not present.
- #
- # Related Assertions, automatically generated:
- # * assert_element_position_left(locator, pattern)
- # * assert_not_element_position_left(locator, pattern)
- # * verify_element_position_left(locator, pattern)
- # * verify_not_element_position_left(locator, pattern)
- # * wait_for_element_position_left(locator, pattern)
- # * wait_for_not_element_position_left(locator, pattern)
- def store_element_position_left locator, variable_name
- command 'storeElementPositionLeft', locator, variable_name
- end
-
- # Retrieves the vertical position of an element. This method will fail
- # if the element is not present.
- #
- # Related Assertions, automatically generated:
- # * assert_element_position_top(locator, pattern)
- # * assert_not_element_position_top(locator, pattern)
- # * verify_element_position_top(locator, pattern)
- # * verify_not_element_position_top(locator, pattern)
- # * wait_for_element_position_top(locator, pattern)
- # * wait_for_not_element_position_top(locator, pattern)
- def store_element_position_top locator, variable_name
- command 'storeElementPositionTop', locator, variable_name
- end
-
- # Return the contents of the log.
- #
- # Related Assertions, automatically generated:
- # * assert_log_messages(pattern)
- # * assert_not_log_messages(pattern)
- # * verify_log_messages(pattern)
- # * verify_not_log_messages(pattern)
- # * wait_for_log_messages(pattern)
- # * wait_for_not_log_messages(pattern)
- def store_log_messages variable_name
- command 'storeLogMessages', variable_name
- end
-
- # Determines whether the specified input element is editable, i.e. hasn't
- # been disabled. This method will fail if the specified element isn't an
- # input element.
- #
- # Related Assertions, automatically generated:
- # * assert_editable(locator)
- # * assert_not_editable(locator)
- # * verify_editable(locator)
- # * verify_not_editable(locator)
- # * wait_for_editable(locator)
- # * wait_for_not_editable(locator)
- def store_editable locator, variable_name
- command 'storeEditable', locator, variable_name
- end
-
- # Returns the IDs of all buttons on the page.
- #
- # If a given button has no ID, it will appear as "" in this array.
- #
- # The +pattern+ for the automatically generated assertions can either take an
- # array or a pattern.
- # assert_all_buttons ['but1', 'but2']
- # assert_all_buttons 'but?,but?*'
- #
- # Related Assertions, automatically generated:
- # * assert_all_buttons(pattern)
- # * assert_not_all_buttons(pattern)
- # * verify_all_buttons(pattern)
- # * verify_not_all_buttons(pattern)
- # * wait_for_all_buttons(pattern)
- # * wait_for_not_all_buttons(pattern)
- def store_all_buttons variable_name
- command 'storeAllButtons', variable_name
- end
-
- # Returns the IDs of all links on the page.
- #
- # If a given link has no ID, it will appear as "" in this array.
- #
- # The +pattern+ for the automatically generated assertions can either take an
- # array or a pattern.
- # assert_all_links ['link1', 'link2']
- # assert_all_links 'link?,link?*'
- #
- # Related Assertions, automatically generated:
- # * assert_all_links(pattern)
- # * assert_not_all_links(pattern)
- # * verify_all_links(pattern)
- # * verify_not_all_links(pattern)
- # * wait_for_all_links(pattern)
- # * wait_for_not_all_links(pattern)
- def store_all_links variable_name
- command 'storeAllLinks', variable_name
- end
-
- # Returns the IDs of all input fields on the page.
- #
- # If a given field has no ID, it will appear as "" in this array.
- #
- # The +pattern+ for the automatically generated assertions can either take an
- # array or a pattern.
- # assert_all_fields ['field1', 'field2']
- # assert_all_fields 'field?,field?*'
- #
- # Related Assertions, automatically generated:
- # * assert_all_fields(pattern)
- # * assert_not_all_fields(pattern)
- # * verify_all_fields(pattern)
- # * verify_not_all_fields(pattern)
- # * wait_for_all_fields(pattern)
- # * wait_for_not_all_fields(pattern)
- def store_all_fields variable_name
- command 'storeAllFields', variable_name
- end
-
- # Returns the entire HTML source between the opening and closing "html" tags.
- #
- # Related Assertions, automatically generated:
- # * assert_html_source(pattern)
- # * assert_not_html_source(pattern)
- # * verify_html_source(pattern)
- # * verify_not_html_source(pattern)
- # * wait_for_html_source(pattern)
- # * wait_for_not_html_source(pattern)
- def store_html_source variable_name
- command 'storeHtmlSource', variable_name
- end
-
- # Returns the specified expression.
- #
- # This is useful because of JavaScript preprocessing.
- #
- # Related Assertions, automatically generated:
- # * assert_expression(expression, pattern)
- # * assert_not_expression(expression, pattern)
- # * verify_expression(expression, pattern)
- # * verify_not_expression(expression, pattern)
- # * wait_for_expression(expression, pattern)
- # * wait_for_not_expression(expression, pattern)
- def store_expression expression, variable_name
- command 'storeExpression', expression, variable_name
- end
-
- # Determine whether current/locator identify the frame containing this
- # running code.
- #
- # This is useful in proxy injection mode, where this code runs in every
- # browser frame and window, and sometimes the selenium server needs to
- # identify the "current" frame. In this case, when the test calls select_frame,
- # this routine is called for each frame to figure out which one has been
- # selected. The selected frame will return true, while all others will return
- # false.
- #
- # NOTE: store_whether_this_frame_match_frame_expression is currently
- # not supported by Selenium Core.
- #
- # Related Assertions, automatically generated:
- # * assert_whether_this_frame_match_frame_expression(current_frame_string, target)
- # * assert_not_whether_this_frame_match_frame_expression(current_frame_string, target)
- # * verify_whether_this_frame_match_frame_expression(current_frame_string, target)
- # * verify_not_whether_this_frame_match_frame_expression(current_frame_string, target)
- # * wait_for_whether_this_frame_match_frame_expression(current_frame_string, target)
- # * wait_for_not_whether_this_frame_match_frame_expression(current_frame_string, target)
- def store_whether_this_frame_match_frame_expression current_frame_string, target, variable_name
- raise 'Not supported in Selenium Core at the moment'
- end
-
- # Determine whether current_window_string plus target identify the window
- # containing this running code.
- #
- # This is useful in proxy injection mode, where this code runs in every browser
- # frame and window, and sometimes the selenium server needs to identify the
- # "current" window. In this case, when the test calls select_window, this routine
- # is called for each window to figure out which one has been selected. The selected
- # window will return true, while all others will return false.
- #
- # NOTE: store_whether_this_window_match_window_expression is currently
- # not supported by Selenium Core.
- #
- # Related Assertions, automatically generated:
- # * assert_whether_this_window_match_window_expression(current_window_string, target)
- # * assert_not_whether_this_window_match_window_expression(current_window_string, target)
- # * verify_whether_this_window_match_window_expression(current_window_string, target)
- # * verify_not_whether_this_window_match_window_expression(current_window_string, target)
- # * wait_for_whether_this_window_match_window_expression(current_window_string, target)
- # * wait_for_not_whether_this_window_match_window_expression(current_window_string, target)
- def store_whether_this_window_match_window_expression current_window_string, target, variable_name
- raise 'Not supported in Selenium Core at the moment'
- end
-
-private
- # Generates all assertions for the accessors.
- def self.generate_methods
- public_instance_methods.each do |method|
- case method
- when 'store_alert_present',
- 'store_prompt_present',
- 'store_confirmation_present'
- each_assertion method do |assertion_method, command_name|
- define_method assertion_method do
- command command_name
- end
- end
- when 'store_error_on_next',
- 'store_failure_on_next',
- 'store_alert',
- 'store_all_window_ids',
- 'store_all_window_names',
- 'store_all_window_titles',
- 'store_confirmation',
- 'store_cookie',
- 'store_log_messages',
- 'store_mouse_speed',
- 'store_prompt',
- 'store_title',
- 'store_body_text',
- 'store_text_present',
- 'store_element_present',
- 'store_visible',
- 'store_editable',
- 'store_html_source',
- 'store_checked',
- 'store_something_selected'
- each_assertion method do |assertion_method, command_name|
- define_method assertion_method do |pattern|
- command command_name, pattern
- end
- end
- when 'store_attribute_from_all_windows',
- 'store_value',
- 'store_text',
- 'store_eval',
- 'store_cursor_position',
- 'store_selected',
- 'store_selected_id',
- 'store_selected_ids',
- 'store_selected_index',
- 'store_selected_indexes',
- 'store_selected_label',
- 'store_selected_labels',
- 'store_selected_value',
- 'store_selected_values',
- 'store_element_height',
- 'store_element_index',
- 'store_element_width',
- 'store_element_position_left',
- 'store_element_position_top',
- 'store_expression',
- 'store_ordered',
- 'store_whether_this_frame_match_frame_expression',
- 'store_whether_this_window_match_window_expression'
- each_assertion method do |assertion_method, command_name|
- define_method assertion_method do |arg1, arg2|
- command command_name, arg1, arg2
- end
- end
- when 'store_all_buttons',
- 'store_all_links',
- 'store_all_fields'
- each_assertion method do |assertion_method, command_name|
- define_method assertion_method do |pattern|
- command command_name, collection_arg(pattern)
- end
- end
- when 'store_select_options',
- 'store_selected_options'
- each_assertion method do |assertion_method, command_name|
- define_method assertion_method do |locator, pattern|
- command command_name, locator, collection_arg(pattern)
- end
- end
- when 'store_attribute'
- each_assertion method do |assertion_method, command_name|
- define_method assertion_method do |locator, attribute_name, pattern|
- command command_name, "#{locator}@#{attribute_name}", pattern
- end
- end
- when 'store_table'
- each_assertion method do |assertion_method, command_name|
- define_method assertion_method do |locator, row, column, pattern|
- command command_name, "#{locator}.#{row}.#{column}", pattern
- end
- end
- when 'store_absolute_location',
- 'store_location'
- each_assertion method do |assertion_method, command_name|
- define_method assertion_method do |pattern|
- if method == 'store_absolute_location' and pattern.is_a? Hash
- pattern[:only_path] = false
- end
-
- command command_name, url_arg(pattern)
- end
- end
- when /^store_/
- raise 'internal error'
- end
- end
- end
-
- # Generates all the assertions needed given a +store_method+.
- def self.each_assertion store_method
- before_negation = nil
- after_negation = store_method.split('_')[1..-1] #throw away 'store'
- if after_negation.last == 'present'
- before_negation, after_negation = after_negation, after_negation.pop
- end
-
- ['assert', 'verify', ['wait','for']].each do |action|
- [nil, 'not'].each do |negation|
- name = [action, before_negation, negation, after_negation].flatten.reject{|a|a.nil?}
- method_name = name.join '_'
- command = name.inject(name.shift.clone) {|n, p| n << p.capitalize}
- yield method_name, command
- end
- end
- end
-
- generate_methods
-end
diff --git a/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/test_builder_actions.rb b/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/test_builder_actions.rb
deleted file mode 100644
index 8eb86f10..00000000
--- a/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/test_builder_actions.rb
+++ /dev/null
@@ -1,514 +0,0 @@
-# The actions available for SeleniumOnRails::TestBuilder tests.
-#
-# For each action +foo+ there's also an action +foo_and_wait+.
-module SeleniumOnRails::TestBuilderActions
- # Tell Selenium on Rails to clear the session and load any fixtures. DO
- # NOT CALL THIS AGAINST NON-TEST DATABASES.
- # The supported +options+ are :keep_session,
- # :fixtures and :clear_tables
- # setup
- # setup :keep_session
- # setup :fixtures => :all
- # setup :keep_session, :fixtures => [:foo, :bar]
- # setup :clear_tables => [:foo, :bar]
- def setup options = {}
- options = {options => nil} unless options.is_a? Hash
-
- opts = {:controller => 'selenium', :action => 'setup'}
- opts[:keep_session] = true if options.has_key? :keep_session
-
- [:fixtures, :clear_tables].each do |key|
- if (f = options[key])
- f = [f] unless f.is_a? Array
- opts[key] = f.join ','
- end
- end
-
- open opts
- end
-
- # Includes a partial.
- # The path is relative to the Selenium tests root. The starting _ and the file
- # extension don't have to be specified.
- # #include test/selenium/_partial.*
- # include_partial 'partial'
- # #include test/selenium/suite/_partial.*
- # include_partial 'suite/partial'
- # #include test/selenium/suite/_partial.* and provide local assigns
- # include_partial 'suite/partial', :foo => bar
- def include_partial path, local_assigns = {}
- partial = @view.render :partial => path, :locals => local_assigns
- @output << partial
- end
-
- # Clicks on a link, button, checkbox or radio button. If the click action
- # causes a new page to load (like a link usually does), call
- # +wait_for_page_to_load+.
- def click locator
- command 'click', locator
- end
-
- # Clicks on a link, button, checkbox or radio button. If the click action causes
- # a new page to load (like a link usually does), call wait_for_page_to_load.
- def click_at locator, coord_string
- command 'clickAt', locator, coord_string
- end
-
- # Explicitly simulate an event (e.g. "focus", "blur"), to
- # trigger the corresponding "on_event_" handler.
- def fire_event locator, event_name
- command 'fireEvent', locator, event_name
- end
-
- # Simulates a user pressing and releasing a key.
- #
- # +keycode+ is the numeric keycode of the key to be pressed, normally the
- # ASCII value of that key.
- def key_press locator, keycode
- command 'keyPress', locator, keycode
- end
-
- # Simulates a user pressing a key (without releasing it yet).
- #
- # +keycode+ is the numeric keycode of the key to be pressed, normally the
- # ASCII value of that key.
- def key_down locator, keycode
- command 'keyDown', locator, keycode
- end
-
- # Simulates a user releasing a key.
- #
- # +keycode+ is the numeric keycode of the key to be released, normally the
- # ASCII value of that key.
- def key_up locator, keycode
- command 'keyUp', locator, keycode
- end
-
- # Simulates a user hovering a mouse over the specified element.
- def mouse_over locator
- command 'mouseOver', locator
- end
-
- # Simulates a user pressing the mouse button (without releasing it yet) on the
- # specified element.
- def mouse_down locator
- command 'mouseDown', locator
- end
-
- # Sets the value of an input field, as though you typed it in.
- #
- # Can also be used to set the value of combo boxes, check boxes, etc. In these
- # cases, +value+ should be the value of the option selected, not the visible
- # text.
- def type locator, value
- command 'type', locator, value
- end
-
- # Check a toggle-button (checkbox/radio).
- def check locator
- command 'check', locator
- end
-
- # Uncheck a toggle-button (checkbox/radio).
- def uncheck locator
- command 'uncheck', locator
- end
-
- # Select an option from a drop-down using an option locator.
- #
- # Option locators provide different ways of specifying options of an HTML
- # Select element (e.g. for selecting a specific option, or for asserting that
- # the selected option satisfies a specification). There are several forms of
- # Select Option Locator.
- #
- # * label=labelPattern
- # matches options based on their labels, i.e. the visible text. (This is the
- # default.)
- # label=regexp:^[Oo]ther
- # * value=valuePattern
- # matches options based on their values.
- # value=other
- # * id=id
- # matches options based on their ids.
- # id=option1
- # * index=index
- # matches an option based on its index (offset from zero).
- # index=2
- #
- # If no option locator prefix is provided, the default behaviour is to match
- # on label.
- def select locator, option_locator
- command 'select', locator, option_locator
- end
-
- # Add a selection to the set of selected options in a multi-select element
- # using an option locator.
- #
- # See the #select command for more information about option locators.
- def add_selection locator, option_locator
- command 'addSelection', locator, option_locator
- end
-
- # Remove a selection from the set of selected options in a multi-select
- # element using an option locator.
- #
- # See the +select+ command for more information about option locators.
- def remove_selection locator, option_locator
- command 'removeSelection', locator, option_locator
- end
-
- # Submit the specified form. This is particularly useful for forms without
- # submit buttons, e.g. single-input "Search" forms.
- def submit locator
- command 'submit', locator
- end
-
- # Opens an URL in the test frame. This accepts both relative and absolute
- # URLs. The open command waits for the page to load before
- # proceeding, i.e. you don't have to call +wait_for_page_to_load+.
- #
- # Note: The URL must be on the same domain as the runner HTML due to security
- # restrictions in the browser (Same Origin Policy).
- def open url
- command 'open', url_arg(url)
- end
-
- # Selects a popup window; once a popup window has been selected, all commands
- # go to that window. To select the main window again, use +nil+ as the target.
- def select_window window_id
- command 'selectWindow', window_id||'null'
- end
-
- # Waits for a popup window to appear and load up.
- #
- # The +timeout+ is specified in milliseconds.
- def wait_for_popup window_id, timeout
- command 'waitForPopUp', window_id||'null', timeout
- end
-
- # By default, Selenium's overridden window.confirm() function will return
- # +true+, as if the user had manually clicked OK. After running this command,
- # the next call to confirm() will return +false+, as if the user had clicked
- # Cancel.
- def choose_cancel_on_next_confirmation
- command 'chooseCancelOnNextConfirmation'
- end
-
- # Instructs Selenium to return the specified answer string in response to the
- # next JavaScript prompt (window.prompt()).
- def answer_on_next_prompt answer
- command 'answerOnNextPrompt', answer
- end
-
- # Simulates the user clicking the "back" button on their browser.
- def go_back
- command 'goBack'
- end
-
- # Simulates the user clicking the "Refresh" button on their browser.
- def refresh
- command 'refresh'
- end
-
- # Simulates the user clicking the "close" button in the titlebar of a popup
- # window or tab.
- def close
- command 'close'
- end
-
- # Simulates the user pressing the alt key and hold it down until do_alt_up()
- # is called or a new page is loaded.
- def alt_key_down
- command 'altKeyDown'
- end
-
- # Simulates the user releasing the alt key.
- def alt_key_up
- command 'altKeyUp'
- end
-
- # Halt the currently running test, and wait for the user to press the Continue
- # button. This command is useful for debugging, but be careful when using it,
- # because it will force automated tests to hang until a user intervenes manually.
- #
- # NOTE: break is a reserved word in Ruby, so we have to simulate
- # Selenium core's break() with brake()
- def brake
- command 'break'
- end
-
- # Simulates the user pressing the alt key and hold it down until do_control_up()
- # is called or a new page is loaded.
- def control_key_down
- command 'controlKeyDown'
- end
-
- # Simulates the user releasing the control key.
- def control_key_up
- command 'controlKeyUp'
- end
-
- # Create a new cookie whose path and domain are same with those of current page
- # under test, unless you specified a path for this cookie explicitly.
- #
- # Arguments:
- # * name_value_pair - name and value of the cookie in a format "name=value"
- # * options_string - options for the cookie. Currently supported options
- # include 'path' and 'max_age'. The options_string's format is
- # "path=/path/, max_age=60". The order of options are irrelevant, the
- # unit of the value of 'max_age' is second.
- def create_cookie name_value_pair, options_string
- command 'createCookie', name_value_pair, options_string
- end
-
- # Delete a named cookie with specified path.
- def delete_cookie name, path
- command 'deleteCookie', name, path
- end
-
- # Double clicks on a link, button, checkbox or radio button. If the double click action
- # causes a new page to load (like a link usually does), call wait_for_page_to_load.
- def double_click locator
- command 'doubleClick', locator
- end
-
- # Doubleclicks on a link, button, checkbox or radio button. If the action causes a new page
- # to load (like a link usually does), call wait_for_page_to_load.
- def double_click_at locator, coord_string
- command 'doubleClickAt', locator, coord_string
- end
-
- # Drags an element a certain distance and then drops it.
- def drag_and_drop locator, movements_string
- command 'dragAndDrop', locator, movements_string
- end
-
- # Drags an element and drops it on another element.
- def drag_and_drop_to_object locator_of_object_to_be_dragged, locator_of_drag_destination_object
- command 'dragAndDropToObject', locator_of_object_to_be_dragged, locator_of_drag_destination_object
- end
-
- # Prints the specified message into the third table cell in your Selenese
- # tables.
- # Useful for debugging.
- def echo message
- command 'echo', message
- end
-
- # Briefly changes the backgroundColor of the specified element yellow.
- # Useful for debugging.
- def highlight locator
- command 'highlight', locator
- end
-
- # Press the meta key and hold it down until doMetaUp() is called or
- # a new page is loaded.
- def meta_key_down
- command 'metaKeyDown'
- end
-
- # Release the meta key.
- def meta_key_up
- command 'metaKeyUp'
- end
-
- # Simulates a user pressing the mouse button (without releasing it yet) on the specified
- # element.
- def mouse_down_at locator, coord_string
- command 'mouseDownAt', locator, coord_string
- end
-
- # Simulates a user moving the mouse.
- def mouse_move locator
- command 'mouseMove', locator
- end
-
- # Simulates a user moving the mouse relative to the specified element.
- def mouse_move_at locator, coord_string
- command 'mouseMoveAt', locator, coord_string
- end
-
- # Simulates the user moving the mouse off the specified element.
- def mouse_out locator
- command 'mouseOut', locator
- end
-
- # Simulates the user releasing the mouse button on the specified element.
- def mouse_up locator
- command 'mouseUp', locator
- end
-
- # Simulates a user pressing the mouse button (without releasing it yet) on the
- # specified element.
- def mouse_up_at locator, coord_string
- command 'mouseUpAt', locator, coord_string
- end
-
- # Opens a popup window (if a window with that ID isn't already open). After opening the
- # window, you'll need to select it using the select_window command.
- #
- # This command can also be a useful workaround for bug SEL-339. In some cases, Selenium
- # will be unable to intercept a call to window.open (if the call occurs during or before
- # the "onLoad" event, for example). In those cases, you can force Selenium to notice the
- # open window's name by using the Selenium openWindow command, using an empty (blank) url,
- # like this: open_window("", "myFunnyWindow").
- def open_window url, window_id
- command 'openWindow', url, window_id
- end
-
- # Wait for the specified amount of time (in milliseconds).
- def pause wait_time
- command 'pause', wait_time
- end
-
- # Unselects all of the selected options in a multi-select element.
- def remove_all_selections locator
- command 'removeAllSelections', locator
- end
-
- # Selects a frame within the current window. (You may invoke this command multiple times
- # to select nested frames.) To select the parent frame, use "relative=parent" as a
- # locator; to select the top frame, use "relative=top".
- #
- # You may also use a DOM expression to identify the frame you want directly, like this:
- # dom=frames["main"].frames["subframe"]
- def select_frame locator
- command 'selectFrame', locator
- end
-
- # Moves the text cursor to the specified position in the given input element or textarea.
- # This method will fail if the specified element isn't an input element or textarea.
- def set_cursor_position locator, position
- command 'setCursorPosition', locator, position
- end
-
- # Configure the number of pixels between "mousemove" events during dragAndDrop commands
- # (default=10).
- # Setting this value to 0 means that we'll send a "mousemove" event to every single pixel
- # in between the start location and the end location; that can be very slow, and may
- # cause some browsers to force the JavaScript to timeout.
- #
- # If the mouse speed is greater than the distance between the two dragged objects, we'll
- # just send one "mousemove" at the start location and then one final one at the end location.
- def set_mouse_speed pixels
- command 'setMouseSpeed', pixels
- end
-
- # Press the shift key and hold it down until doShiftUp() is called or a new page
- # is loaded.
- def shift_key_down
- command 'shiftKeyDown'
- end
-
- # Release the shift key.
- def shift_key_up
- command 'shiftKeyUp'
- end
-
- # This command is a synonym for store_expression.
- def store expression, variable_name
- command 'store', expression, variable_name
- end
-
- # Simulates keystroke events on the specified element, as though you typed the value
- # key-by-key.
- #
- # This is a convenience method for calling key_down, key_up,
- # key_press for every character in the specified string; this is useful for
- # dynamic UI widgets (like auto-completing combo boxes) that require explicit key events.
- #
- # Unlike the simple "type" command, which forces the specified value into the page directly,
- # this command may or may not have any visible effect, even in cases where typing keys would
- # normally have a visible effect. For example, if you use "type_keys" on a form
- # element, you may or may not see the results of what you typed in the field.
- #
- # In some cases, you may need to use the simple "type" command to set the value of the field
- # and then the "type_keys" command to send the keystroke events corresponding to
- # what you just typed.
- def type_keys locator, value
- command 'typeKeys', locator, value
- end
-
- # Gives focus to a window.
- def window_focus window_name
- command 'windowFocus', window_name
- end
-
- # Resize window to take up the entire screen.
- def window_maximize window_name
- command 'windowMaximize', window_name
- end
-
- # Writes a message to the status bar and adds a note to the browser-side log.
- #
- # +context+ is the message sent to the browser.
- #
- # +log_level_threshold+ can be +nil+, :debug, :info,
- # :warn or :error.
- def set_context context, log_level_threshold = nil
- if log_level_threshold
- command 'setContext', context, log_level_threshold.to_s
- else
- command 'setContext', context
- end
- end
-
- # Runs the specified JavaScript snippet repeatedly until it evaluates to
- # +true+. The snippet may have multiple lines, but only the result of the last
- # line will be considered.
- #
- # Note that, by default, the snippet will be run in the runner's test window,
- # not in the window of your application. To get the window of your
- # application, you can use the JavaScript snippet
- # selenium.browserbot.getCurrentWindow(), and then run your
- # JavaScript in there.
- #
- # +timeout+ is specified in milliseconds.
- def wait_for_condition script, timeout
- command 'waitForCondition', script, timeout
- end
-
- # Specifies the amount of time that Selenium will wait for actions to
- # complete.
- #
- # Actions that require waiting include +open+ and the wait_for*
- # actions.
- #
- # The default timeout is 30 seconds.
- #
- # +timeout+ is specified in milliseconds.
- def set_timeout timeout
- command 'setTimeout', timeout
- end
-
- # Waits for a new page to load.
- #
- # You can use this command instead of the +and_wait+ suffixes,
- # +click_and_wait+, +select_and_wait+, +type_and_wait+ etc. (which are only
- # available in the JS API).
- #
- # Selenium constantly keeps track of new pages loading, and sets a
- # +newPageLoaded+ flag when it first notices a page load. Running any other
- # Selenium command after turns the flag to +false+. Hence, if you want to wait
- # for a page to load, you must wait immediately after a Selenium command that
- # caused a page-load.
- #
- # +timeout+ is specified in milliseconds.
- def wait_for_page_to_load timeout
- command 'waitForPageToLoad', timeout
- end
-
-private
- # Generates the corresponding +_and_wait+ for each action.
- def self.generate_and_wait_actions
- public_instance_methods.each do |method|
- define_method method + '_and_wait' do |*args|
- methods_array = method.split("_")
- send 'command_and_wait', methods_array.first.downcase + methods_array[1..-1].collect{|part| part.camelize}.join, *args
- end
- end
- end
-
- generate_and_wait_actions
-end
-
diff --git a/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/test_builder_user_accessors.rb.example b/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/test_builder_user_accessors.rb.example
deleted file mode 100644
index 8f5d01fd..00000000
--- a/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/test_builder_user_accessors.rb.example
+++ /dev/null
@@ -1,91 +0,0 @@
-# Mirrors the accessors specified in user-extensions.js from the selenium-core
-module SeleniumOnRails::TestBuilderUserAccessors
-
- # Return the length of text of a specified element.
- #
- # Related Assertions, automatically generated:
- # * assert_text_length(locator, variable)
- # * assert_not_text_length(locator, length)
- # * verify_text_length(locator, length)
- # * verify_not_text_length(locator, length)
- # * wait_for_text_length(locator, length)
- # * wait_for_not_text_length(locator, length)
- def store_text_length locator, variable_name
- command 'storeTextLength', locator, variable_name
- end
-
- # Checks if value entered more than once in textbox.
- #
- # Related Assertions, automatically generated:
- # * assert_not_text_length(locator, text)
- # * verify_text_length(locator, text)
- # * verify_not_text_length(locator, text)
- # * wait_for_text_length(locator, text)
- # * wait_for_not_text_length(locator, text)
- def assert_value_repeated locator, text
- command 'assertValueRepeated', locator, text
- end
-
- private
-
- def self.generate_methods
- public_instance_methods.each do |method|
- case method
- when 'store_text_length'
- each_assertion method do |assertion_method, command_name|
- define_method assertion_method do |arg1, arg2|
- command command_name, arg1, arg2
- end
- end
- when 'assert_value_repeated'
- each_check method do |check_method, command_name|
- define_method check_method do |arg1, arg2|
- command command_name, arg1, arg2
- end
- end
- else
- raise "Internal error: Don't know how to process user accessor: #{method}"
- end
- end
- end
-
- # Generates all the assertions needed given a +store_method+.
- def self.each_assertion store_method
- before_negation = nil
- after_negation = store_method.split('_')[1..-1] #throw away 'store'
- if after_negation.last == 'present'
- before_negation, after_negation = after_negation, after_negation.pop
- end
-
- ['assert', 'verify', ['wait','for']].each do |action|
- [nil, 'not'].each do |negation|
- name = [action, before_negation, negation, after_negation].flatten.reject{|a|a.nil?}
- method_name = name.join '_'
- command = name.inject(name.shift.clone) {|n, p| n << p.capitalize}
- yield method_name, command
- end
- end
- end
-
- def self.each_check assert_method
- before_negation = nil
- after_negation = assert_method.split('_')[1..-1] #throw away 'assert'
- if after_negation.last == 'present'
- before_negation, after_negation = after_negation, after_negation.pop
- end
-
- ['assert', 'verify', ['wait', 'for']].each do |action|
- [nil, 'not'].each do |negation|
- unless (action == 'assert' && negation.nil?)
- name = [action, before_negation, negation, after_negation].flatten.reject{|a|a.nil?}
- method_name = name.join '_'
- command = name.inject(name.shift.clone) {|n, p| n << p.capitalize}
- yield method_name, command
- end
- end
- end
- end
-
- generate_methods
-
-end
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/test_builder_user_actions.rb.example b/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/test_builder_user_actions.rb.example
deleted file mode 100644
index 7a775fdd..00000000
--- a/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/test_builder_user_actions.rb.example
+++ /dev/null
@@ -1,24 +0,0 @@
-# Mirrors the actions specified in user-extensions.js from the selenium-core
-module SeleniumOnRails::TestBuilderUserActions
-
- # Types the text twice into a text box.
- def type_repeated locator, text
- command 'typeRepeated', locator, text
- end
-
- private
-
- # Generates the corresponding +_and_wait+ for each action.
- def self.generate_and_wait_actions
- public_instance_methods.each do |method|
- define_method method + '_and_wait' do |*args|
- make_command_waiting do
- send method, *args
- end
- end
- end
- end
-
- generate_and_wait_actions
-
-end
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/lib/selenium_on_rails_config.rb b/vendor/plugins/selenium-on-rails/lib/selenium_on_rails_config.rb
deleted file mode 100644
index 1512fdc3..00000000
--- a/vendor/plugins/selenium-on-rails/lib/selenium_on_rails_config.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-require 'yaml'
-require 'erb'
-
-class SeleniumOnRailsConfig
- @@defaults = {:environments => ['test']}
- def self.get var, default = nil
- value = configs[var.to_s]
- value ||= @@defaults[var]
- value ||= default
- value ||= yield if block_given?
- value
- end
-
- private
- def self.configs
- @@configs ||= nil
- unless @@configs
- files = [File.join(RAILS_ROOT, 'config', 'selenium.yml'), File.expand_path(File.dirname(__FILE__) + '/../config.yml')]
- files.each do |file|
- if File.exist?(file)
- @@configs = YAML.load(ERB.new(IO.read(file)).result)
- break
- end
- end
- @@configs ||= {}
- end
- @@configs
- end
-
-end
diff --git a/vendor/plugins/selenium-on-rails/lib/views/layouts/layout.rhtml b/vendor/plugins/selenium-on-rails/lib/views/layouts/layout.rhtml
deleted file mode 100644
index 16f827fd..00000000
--- a/vendor/plugins/selenium-on-rails/lib/views/layouts/layout.rhtml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
- Selenium on Rails<%= defined?(@page_title) ? ": #{@page_title}" : '' %>
-
-
-
-<%= @content_for_layout %>
-
-
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/lib/views/record.rhtml b/vendor/plugins/selenium-on-rails/lib/views/record.rhtml
deleted file mode 100644
index 65687553..00000000
--- a/vendor/plugins/selenium-on-rails/lib/views/record.rhtml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-<% @result.each_pair do |key, value| -%>
-| <%= key %> | <%= value %> |
-<% end -%>
-
diff --git a/vendor/plugins/selenium-on-rails/lib/views/selenium_helper.rb b/vendor/plugins/selenium-on-rails/lib/views/selenium_helper.rb
deleted file mode 100644
index 4e178536..00000000
--- a/vendor/plugins/selenium-on-rails/lib/views/selenium_helper.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-module SeleniumHelper
- include SeleniumOnRails::SuiteRenderer
- include SeleniumOnRails::FixtureLoader
-
- def test_case_name filename
- File.basename(filename).sub(/\..*/,'').humanize
- end
-
-end
diff --git a/vendor/plugins/selenium-on-rails/lib/views/setup.rhtml b/vendor/plugins/selenium-on-rails/lib/views/setup.rhtml
deleted file mode 100644
index 4091124b..00000000
--- a/vendor/plugins/selenium-on-rails/lib/views/setup.rhtml
+++ /dev/null
@@ -1,67 +0,0 @@
-<% @page_title = 'Setup' -%>
-<% if defined?(@session_wiped) or @cleared_tables.any? or @loaded_fixtures.any? -%>
-
- <% if defined?(@session_wiped) -%>
-
The session is wiped clean.
- <% end-%>
- <% if @cleared_tables.any? -%>
-
The following database tables are cleared:
-
- <% for table in @cleared_tables -%>
- - <%= table %>
- <% end-%>
-
- <% end -%>
- <% if @loaded_fixtures.any? -%>
-
The following fixtures are loaded:
-
- <% for fixture in @loaded_fixtures -%>
- - <%= fixture %>
- <% end-%>
-
- <% end -%>
-
-<% end -%>
-
-
-
This page can be used to setup your Selenium tests. The following options can be used:
-
- - keep_session
- -
- Per default the session is reset, so add keep_session in order to keep the current session.
-
- | open | <%= url_for %>?keep_session | |
-
-
- - fixtures
- -
- Loads one or many fixtures into the database. This will destroy the current data you have in your database! Use all as name in order to load all fixtures, or specify which fixtures that should be loaded (delimited by commas).
- If a test needs different data than you have in your fixtures, you can add another fixture set. A fixture set is just a sub directory in /test/fixtures/ where you can add alternate fixtures (e.g. /test/fixtures/blank/users.yml).
-
- | open | <%= url_for :fixtures => 'all' %> | |
- | open | <%= url_for :fixtures => 'fixture' %> | |
- | open | <%= url_for :fixtures => 'fixture_one' %>,fixture_two | |
-
- Available fixtures
- <% fixtures = available_fixtures -%>
- <% for fixture_set in fixtures.keys.sort -%>
- In the <%= fixture_set.blank? ? 'default' : "#{fixture_set}" %> fixture set:
-
- <% fixtures[fixture_set].unshift fixture_set.blank? ? 'all' : "#{fixture_set}/all" -%>
- <% for fixture in fixtures[fixture_set] -%>
- - <%= fixture %>
- <% end -%>
-
- <% end -%>
-
- - clear_tables
- -
- Clears one or many database tables. Another way to do the same thing is to create an empty fixture in a new fixture set (see fixtures above).
-
- | open | <%= url_for :clear_tables => 'sessions' %> | |
- | open | <%= url_for :clear_tables => 'sessions' %>,outgoing_messages | |
-
-
-
-
-
diff --git a/vendor/plugins/selenium-on-rails/lib/views/test_suite.rhtml b/vendor/plugins/selenium-on-rails/lib/views/test_suite.rhtml
deleted file mode 100644
index 5973fc97..00000000
--- a/vendor/plugins/selenium-on-rails/lib/views/test_suite.rhtml
+++ /dev/null
@@ -1,26 +0,0 @@
-<% @page_title = test_suite_name @suite_path -%>
-
-
-
-
- | <%= @page_title %> |
-<% for name, path in test_cases @suite_path -%>
- | <%= link_to_test_case name, path %> |
-<% end -%>
-
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/routes.rb b/vendor/plugins/selenium-on-rails/routes.rb
deleted file mode 100644
index 9f3454d9..00000000
--- a/vendor/plugins/selenium-on-rails/routes.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-module ActionController
- module Routing #:nodoc:
- class RouteSet #:nodoc:
- alias_method :draw_without_selenium_routes, :draw
- def draw
- draw_without_selenium_routes do |map|
- map.connect 'selenium/setup',
- :controller => 'selenium', :action => 'setup'
- map.connect 'selenium/tests/*testname',
- :controller => 'selenium', :action => 'test_file'
- map.connect 'selenium/postResults',
- :controller => 'selenium', :action => 'record'
- map.connect 'selenium/postResults/:logFile',
- :controller => 'selenium', :action => 'record', :requirements => { :logFile => /.*/ }
- map.connect 'selenium/*filename',
- :controller => 'selenium', :action => 'support_file'
- map.connect 'switch_environment',
- :controller => 'switch_environment', :action => 'index'
- yield map if block_given?
- end
- end
- end
- end
-end
diff --git a/vendor/plugins/selenium-on-rails/selenium-core/Blank.html b/vendor/plugins/selenium-on-rails/selenium-core/Blank.html
deleted file mode 100644
index 838f933b..00000000
--- a/vendor/plugins/selenium-on-rails/selenium-core/Blank.html
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
diff --git a/vendor/plugins/selenium-on-rails/selenium-core/InjectedRemoteRunner.html b/vendor/plugins/selenium-on-rails/selenium-core/InjectedRemoteRunner.html
deleted file mode 100644
index cb4432c0..00000000
--- a/vendor/plugins/selenium-on-rails/selenium-core/InjectedRemoteRunner.html
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
- selenium-rc initial page
-
-
diff --git a/vendor/plugins/selenium-on-rails/selenium-core/RemoteRunner.html b/vendor/plugins/selenium-on-rails/selenium-core/RemoteRunner.html
deleted file mode 100644
index da9f9771..00000000
--- a/vendor/plugins/selenium-on-rails/selenium-core/RemoteRunner.html
+++ /dev/null
@@ -1,110 +0,0 @@
-
-
-
-
-
-
-Selenium Remote Control
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- |
-
-
- |
-
- Command History:
-
- |
-
-
- |
-
- |
-
-
-
-
-
-
diff --git a/vendor/plugins/selenium-on-rails/selenium-core/SeleniumLog.html b/vendor/plugins/selenium-on-rails/selenium-core/SeleniumLog.html
deleted file mode 100644
index 2b55fe76..00000000
--- a/vendor/plugins/selenium-on-rails/selenium-core/SeleniumLog.html
+++ /dev/null
@@ -1,109 +0,0 @@
-
-
-
-Selenium Log Console
-
-
-
-
-
-
-
-
-
-
- Selenium Log Console
-
-
-
-
-
-
diff --git a/vendor/plugins/selenium-on-rails/selenium-core/TestPrompt.html b/vendor/plugins/selenium-on-rails/selenium-core/TestPrompt.html
deleted file mode 100644
index db202930..00000000
--- a/vendor/plugins/selenium-on-rails/selenium-core/TestPrompt.html
+++ /dev/null
@@ -1,145 +0,0 @@
-
-
-
-
-
- Select a Test Suite
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/selenium-core/TestRunner-splash.html b/vendor/plugins/selenium-on-rails/selenium-core/TestRunner-splash.html
deleted file mode 100644
index da2acdce..00000000
--- a/vendor/plugins/selenium-on-rails/selenium-core/TestRunner-splash.html
+++ /dev/null
@@ -1,55 +0,0 @@
-
-
-
-
-
-
-
-
- | ↑ |
- ↑ |
- ↑ |
-
-
- | Test Suite |
- Current Test |
- Control Panel |
-
-| |
-
-
- |
-
-
-
-
-Selenium
-
-
-
-For more information on Selenium, visit
-
-
- http://selenium.openqa.org
-
-
- |
-
-
-
-
-
diff --git a/vendor/plugins/selenium-on-rails/selenium-core/TestRunner.hta b/vendor/plugins/selenium-on-rails/selenium-core/TestRunner.hta
deleted file mode 100644
index ab481594..00000000
--- a/vendor/plugins/selenium-on-rails/selenium-core/TestRunner.hta
+++ /dev/null
@@ -1,177 +0,0 @@
-
-
-
-
-
-
-
-
-
-
- Selenium Functional Test Runner
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/vendor/plugins/selenium-on-rails/selenium-core/TestRunner.html b/vendor/plugins/selenium-on-rails/selenium-core/TestRunner.html
deleted file mode 100644
index ab481594..00000000
--- a/vendor/plugins/selenium-on-rails/selenium-core/TestRunner.html
+++ /dev/null
@@ -1,177 +0,0 @@
-
-
-
-
-
-
-
-
-
-
- Selenium Functional Test Runner
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/vendor/plugins/selenium-on-rails/selenium-core/domviewer/butmin.gif b/vendor/plugins/selenium-on-rails/selenium-core/domviewer/butmin.gif
deleted file mode 100644
index 7b7cefd5..00000000
Binary files a/vendor/plugins/selenium-on-rails/selenium-core/domviewer/butmin.gif and /dev/null differ
diff --git a/vendor/plugins/selenium-on-rails/selenium-core/domviewer/butplus.gif b/vendor/plugins/selenium-on-rails/selenium-core/domviewer/butplus.gif
deleted file mode 100644
index 6d68cfa9..00000000
Binary files a/vendor/plugins/selenium-on-rails/selenium-core/domviewer/butplus.gif and /dev/null differ
diff --git a/vendor/plugins/selenium-on-rails/selenium-core/domviewer/domviewer.css b/vendor/plugins/selenium-on-rails/selenium-core/domviewer/domviewer.css
deleted file mode 100644
index b64b2435..00000000
--- a/vendor/plugins/selenium-on-rails/selenium-core/domviewer/domviewer.css
+++ /dev/null
@@ -1,298 +0,0 @@
-/******************************************************************************
-* Defines default styles for site pages. *
-******************************************************************************/
-.hidden {
- display: none;
-}
-
-img{
- display: inline;
- border: none;
-}
-
-.box{
- background: #fcfcfc;
- border: 1px solid #000;
- border-color: blue;
- color: #000000;
- margin: 10px auto;
- padding: 3px;
- vertical-align: bottom;
-}
-a {
- text-decoration: none;
-}
-
-body {
- background-color: #ffffff;
- color: #000000;
- font-family: Arial, Helvetica, sans-serif;
- font-size: 10pt;
-}
-
-h2 {
- font-size: 140%;
-}
-
-h3 {
- font-size: 120%;
-}
-
-h4 {
- font-size: 100%;
-}
-
-pre {
- font-family: Courier New, Courier, monospace;
- font-size: 80%;
-}
-
-td, th {
- font-family: Arial, Helvetica, sans-serif;
- font-size: 10pt;
- text-align: left;
- vertical-align: top;
-}
-
-th {
- font-weight: bold;
- vertical-align: bottom;
-}
-
-ul {
- list-style-type: square;
-}
-
-#demoBox {
- border-color: #000000;
- border-style: solid;
- border-width: 1px;
- padding: 8px;
- width: 24em;
-}
-
-.footer {
- margin-bottom: 0px;
- text-align: center;
-}
-
-/* Boxed table styles */
-
-table.boxed {
- border-spacing: 2px;
- empty-cells: hide;
-}
-
-td.boxed, th.boxed, th.boxedHeader {
- background-color: #ffffff;
- border-color: #000000;
- border-style: solid;
- border-width: 1px;
- color: #000000;
- padding: 2px;
- padding-left: 8px;
- padding-right: 8px;
-}
-
-th.boxed {
- background-color: #c0c0c0;
-}
-
-th.boxedHeader {
- background-color: #808080;
- color: #ffffff;
-}
-
-a.object {
- color: #0000ff;
-}
-
-li {
- white-space: nowrap;
-}
-
-ul {
- list-style-type: square;
- margin-left: 0px;
- padding-left: 1em;
-}
-
-.boxlevel1{
- background: #FFD700;
-}
-
-.boxlevel2{
- background: #D2691E;
-}
-
-.boxlevel3{
- background: #DCDCDC;
-}
-
-.boxlevel4{
- background: #F5F5F5;
-}
-
-.boxlevel5{
- background: #BEBEBE;
-}
-
-.boxlevel6{
- background: #D3D3D3;
-}
-
-.boxlevel7{
- background: #A9A9A9;
-}
-
-.boxlevel8{
- background: #191970;
-}
-
-.boxlevel9{
- background: #000080;
-}
-
-.boxlevel10{
- background: #6495ED;
-}
-
-.boxlevel11{
- background: #483D8B;
-}
-
-.boxlevel12{
- background: #6A5ACD;
-}
-
-.boxlevel13{
- background: #7B68EE;
-}
-
-.boxlevel14{
- background: #8470FF;
-}
-
-.boxlevel15{
- background: #0000CD;
-}
-
-.boxlevel16{
- background: #4169E1;
-}
-
-.boxlevel17{
- background: #0000FF;
-}
-
-.boxlevel18{
- background: #1E90FF;
-}
-
-.boxlevel19{
- background: #00BFFF;
-}
-
-.boxlevel20{
- background: #87CEEB;
-}
-
-.boxlevel21{
- background: #B0C4DE;
-}
-
-.boxlevel22{
- background: #ADD8E6;
-}
-
-.boxlevel23{
- background: #00CED1;
-}
-
-.boxlevel24{
- background: #48D1CC;
-}
-
-.boxlevel25{
- background: #40E0D0;
-}
-
-.boxlevel26{
- background: #008B8B;
-}
-
-.boxlevel27{
- background: #00FFFF;
-}
-
-.boxlevel28{
- background: #E0FFFF;
-}
-
-.boxlevel29{
- background: #5F9EA0;
-}
-
-.boxlevel30{
- background: #66CDAA;
-}
-
-.boxlevel31{
- background: #7FFFD4;
-}
-
-.boxlevel32{
- background: #006400;
-}
-
-.boxlevel33{
- background: #556B2F;
-}
-
-.boxlevel34{
- background: #8FBC8F;
-}
-
-.boxlevel35{
- background: #2E8B57;
-}
-
-.boxlevel36{
- background: #3CB371;
-}
-
-.boxlevel37{
- background: #20B2AA;
-}
-
-.boxlevel38{
- background: #00FF7F;
-}
-
-.boxlevel39{
- background: #7CFC00;
-}
-
-.boxlevel40{
- background: #90EE90;
-}
-
-.boxlevel41{
- background: #00FF00;
-}
-
-.boxlevel41{
- background: #7FFF00;
-}
-
-.boxlevel42{
- background: #00FA9A;
-}
-
-.boxlevel43{
- background: #ADFF2F;
-}
-
-.boxlevel44{
- background: #32CD32;
-}
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/selenium-core/domviewer/domviewer.html b/vendor/plugins/selenium-on-rails/selenium-core/domviewer/domviewer.html
deleted file mode 100644
index 9158a50f..00000000
--- a/vendor/plugins/selenium-on-rails/selenium-core/domviewer/domviewer.html
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
- DOM Viewer
-
-
-
-
-
- DOM Viewer
- This page is generated using JavaScript. If you see this text, your
- browser doesn't support JavaScript.
-
-
-
diff --git a/vendor/plugins/selenium-on-rails/selenium-core/domviewer/selenium-domviewer.js b/vendor/plugins/selenium-on-rails/selenium-core/domviewer/selenium-domviewer.js
deleted file mode 100644
index 941aab16..00000000
--- a/vendor/plugins/selenium-on-rails/selenium-core/domviewer/selenium-domviewer.js
+++ /dev/null
@@ -1,205 +0,0 @@
-var HIDDEN="hidden";
-var LEVEL = "level";
-var PLUS_SRC="butplus.gif";
-var MIN_SRC="butmin.gif";
-var newRoot;
-var maxColumns=1;
-
-function loadDomViewer() {
- // See if the rootDocument variable has been set on this window.
- var rootDocument = window.rootDocument;
-
- // If not look to the opener for an explicity rootDocument variable, otherwise, use the opener document
- if (!rootDocument && window.opener) {
- rootDocument = window.opener.rootDocument || window.opener.document;
- }
-
- if (rootDocument) {
- document.body.innerHTML = displayDOM(rootDocument);
- }
- else {
- document.body.innerHTML = "Must specify rootDocument for window. This can be done by setting the rootDocument variable on this window, or on the opener window for a popup window.";
- }
-}
-
-
-function displayDOM(root){
- var str = "";
- str+="";
- str += treeTraversal(root,0);
- // to make table columns work well.
- str += "";
- for (var i=0; i < maxColumns; i++) {
- str+= "| | ";
- }
- str += "
";
- str += "
";
- return str;
-}
-
-function checkForChildren(element){
- if(!element.hasChildNodes())
- return false;
-
- var nodes = element.childNodes;
- var size = nodes.length;
- var count=0;
-
- for(var i=0; i< size; i++){
- var node = nodes.item(i);
- //if(node.toString()=="[object Text]"){
- //this is equalent to the above
- //but will work with more browsers
- if(node.nodeType!=1){
- count++;
- }
- }
-
- if(count == size)
- return false;
- else
- return true;
-}
-
-function treeTraversal(root, level){
- var str = "";
- var nodes= null;
- var size = null;
- //it is supposed to show the last node,
- //but the last node is always nodeText type
- //and we don't show it
- if(!root.hasChildNodes())
- return "";//displayNode(root,level,false);
-
- nodes = root.childNodes;
- size = nodes.length;
-
- for(var i=0; i< size; i++){
- var element = nodes.item(i);
- //if the node is textNode, don't display
- if(element.nodeType==1){
- str+= displayNode(element,level,checkForChildren(element));
- str+=treeTraversal(element, level+1);
- }
- }
- return str;
-}
-
-function displayNode(element, level, isLink){
- nodeContent = getNodeContent(element);
- columns = Math.round((nodeContent.length / 12) + 0.5);
- if (columns + level > maxColumns) {
- maxColumns = columns + level;
- }
- var str ="";
- for (var i=0; i < level; i++)
- str+= "| | ";
- str+="";
- if(isLink){
- str+='';
- str+=' ';
- }
- str += nodeContent;
- if(isLink)
- str+=" |
";
- return str;
-}
-
-function getNodeContent(element) {
-
- str = "";
- id ="";
- if (element.id != null && element.id != "") {
- id = " ID(" + element.id +")";
- }
- name ="";
- if (element.name != null && element.name != "") {
- name = " NAME(" + element.name + ")";
- }
- value ="";
- if (element.value != null && element.value != "") {
- value = " VALUE(" + element.value + ")";
- }
- href ="";
- if (element.href != null && element.href != "") {
- href = " HREF(" + element.href + ")";
- }
- clazz = "";
- if (element.className != null && element.className != "") {
- clazz = " CLASS(" + element.className + ")";
- }
- src = "";
- if (element.src != null && element.src != "") {
- src = " SRC(" + element.src + ")";
- }
- alt = "";
- if (element.alt != null && element.alt != "") {
- alt = " ALT(" + element.alt + ")";
- }
- type = "";
- if (element.type != null && element.type != "") {
- type = " TYPE(" + element.type + ")";
- }
- text ="";
- if (element.text != null && element.text != "" && element.text != "undefined") {
- text = " #TEXT(" + trim(element.text) +")";
- }
- str+=" "+ element.nodeName + id + alt + type + clazz + name + value + href + src + text + "";
- return str;
-
-}
-
-function trim(val) {
- val2 = val.substring(0,40) + " ";
- var spaceChr = String.fromCharCode(32);
- var length = val2.length;
- var retVal = "";
- var ix = length -1;
-
- while(ix > -1){
- if(val2.charAt(ix) == spaceChr) {
- } else {
- retVal = val2.substring(0, ix +1);
- break;
- }
- ix = ix-1;
- }
- if (val.length > 40) {
- retVal += "...";
- }
- return retVal;
-}
-
-function hide(hlink){
- var isHidden = false;
- var image = hlink.firstChild;
- if(image.src.toString().indexOf(MIN_SRC)!=-1){
- image.src=PLUS_SRC;
- isHidden=true;
- }else{
- image.src=MIN_SRC;
- }
- var rowObj= hlink.parentNode.parentNode;
- var rowLevel = parseInt(rowObj.className.substring(LEVEL.length));
-
- var sibling = rowObj.nextSibling;
- var siblingLevel = sibling.className.substring(LEVEL.length);
- if(siblingLevel.indexOf(HIDDEN)!=-1){
- siblingLevel = siblingLevel.substring(0,siblingLevel.length - HIDDEN.length-1);
- }
- siblingLevel=parseInt(siblingLevel);
- while(sibling!=null && rowLevel
-
-
-
-Defines an object that runs Selenium commands.
-
-Element Locators
-
-Element Locators tell Selenium which HTML element a command refers to.
-The format of a locator is:
-
-locatorType=argument
-
-
-
-We support the following strategies for locating elements:
-
-
-
-- identifier=id:
-Select the element with the specified @id attribute. If no match is
-found, select the first element whose @name attribute is id.
-(This is normally the default; see below.)
-- id=id:
-Select the element with the specified @id attribute.
-
-- name=name:
-Select the first element with the specified @name attribute.
-
-- username
-- name=username
-
-
-The name may optionally be followed by one or more element-filters, separated from the name by whitespace. If the filterType is not specified, value is assumed.
-
-
-- name=flavour value=chocolate
-
-
-- dom=javascriptExpression:
-
-Find an element by evaluating the specified string. This allows you to traverse the HTML Document Object
-Model using JavaScript. Note that you must not return a value in this string; simply make it the last expression in the block.
-
-- dom=document.forms['myForm'].myDropdown
-- dom=document.images[56]
-- dom=function foo() { return document.links[1]; }; foo();
-
-
-
-
-- xpath=xpathExpression:
-Locate an element using an XPath expression.
-
-- xpath=//img[@alt='The image alt text']
-- xpath=//table[@id='table1']//tr[4]/td[2]
-- xpath=//a[contains(@href,'#id1')]
-- xpath=//a[contains(@href,'#id1')]/@class
-- xpath=(//table[@class='stylee'])//th[text()='theHeaderText']/../td
-- xpath=//input[@name='name2' and @value='yes']
-- xpath=//*[text()="right"]
-
-
-
-- link=textPattern:
-Select the link (anchor) element which contains text matching the
-specified pattern.
-
-
-
-
-- css=cssSelectorSyntax:
-Select the element using css selectors. Please refer to CSS2 selectors, CSS3 selectors for more information. You can also check the TestCssLocators test in the selenium test suite for an example of usage, which is included in the downloaded selenium core package.
-
-- css=a[href="#id3"]
-- css=span#firstChild + span
-
-Currently the css selector locator supports all css1, css2 and css3 selectors except namespace in css3, some pseudo classes(:nth-of-type, :nth-last-of-type, :first-of-type, :last-of-type, :only-of-type, :visited, :hover, :active, :focus, :indeterminate) and pseudo elements(::first-line, ::first-letter, ::selection, ::before, ::after).
-
-
-- ui=uiSpecifierString:
-Locate an element by resolving the UI specifier string to another locator, and evaluating it. See the Selenium UI-Element Reference for more details.
-
-- ui=loginPages::loginButton()
-- ui=settingsPages::toggle(label=Hide Email)
-- ui=forumPages::postBody(index=2)//a[2]
-
-
-
-
-
-
-Without an explicit locator prefix, Selenium uses the following default
-strategies:
-
-
-
-- dom, for locators starting with "document."
-- xpath, for locators starting with "//"
-- identifier, otherwise
-
-
-
-
-Element filters can be used with a locator to refine a list of candidate elements. They are currently used only in the 'name' element-locator.
-Filters look much like locators, ie.
-
-filterType=argument
-
-Supported element-filters are:
-value=valuePattern
-
-Matches elements based on their values. This is particularly useful for refining a list of similarly-named toggle-buttons.
-index=index
-
-Selects a single element based on its position in the list (offset from zero).
-
-
-String-match Patterns
-
-
-Various Pattern syntaxes are available for matching string values:
-
-
-- glob:pattern:
-Match a string against a "glob" (aka "wildmat") pattern. "Glob" is a
-kind of limited regular-expression syntax typically used in command-line
-shells. In a glob pattern, "*" represents any sequence of characters, and "?"
-represents any single character. Glob patterns match against the entire
-string.
-- regexp:regexp:
-Match a string using a regular-expression. The full power of JavaScript
-regular-expressions is available.
-- regexpi:regexpi:
-Match a string using a case-insensitive regular-expression.
-- exact:string:
-
-Match a string exactly, verbatim, without any of that fancy wildcard
-stuff.
-
-
-If no pattern prefix is specified, Selenium assumes that it's a "glob"
-pattern.
-
-
-For commands that return multiple values (such as verifySelectOptions),
-the string being matched is a comma-separated list of the return values,
-where both commas and backslashes in the values are backslash-escaped.
-When providing a pattern, the optional matching syntax (i.e. glob,
-regexp, etc.) is specified once, as usual, at the beginning of the
-pattern.
-
-
-
-
-an element locator
-
-Clicks on a link, button, checkbox or radio button. If the click action
-causes a new page to load (like a link usually does), call
-waitForPageToLoad.
-
-
-
-
-
-an element locator
-
-Double clicks on a link, button, checkbox or radio button. If the double click action
-causes a new page to load (like a link usually does), call
-waitForPageToLoad.
-
-
-
-
-
-an element locator
-
-Simulates opening the context menu for the specified element (as might happen if the user "right-clicked" on the element).
-
-
-
-
-
-an element locator
-
-specifies the x,y position (i.e. - 10,20) of the mouse event relative to the element returned by the locator.
-
-Clicks on a link, button, checkbox or radio button. If the click action
-causes a new page to load (like a link usually does), call
-waitForPageToLoad.
-
-
-
-
-
-an element locator
-
-specifies the x,y position (i.e. - 10,20) of the mouse event relative to the element returned by the locator.
-
-Doubleclicks on a link, button, checkbox or radio button. If the action
-causes a new page to load (like a link usually does), call
-waitForPageToLoad.
-
-
-
-
-
-an element locator
-
-specifies the x,y position (i.e. - 10,20) of the mouse event relative to the element returned by the locator.
-
-Simulates opening the context menu for the specified element (as might happen if the user "right-clicked" on the element).
-
-
-
-
-
-an element locator
-
-the event name, e.g. "focus" or "blur"
-
-Explicitly simulate an event, to trigger the corresponding "onevent"
-handler.
-
-
-
-
-
-an element locator
-
-Move the focus to the specified element; for example, if the element is an input field, move the cursor to that field.
-
-
-
-
-
-an element locator
-
-Either be a string("\" followed by the numeric keycode of the key to be pressed, normally the ASCII value of that key), or a single character. For example: "w", "\119".
-
-Simulates a user pressing and releasing a key.
-
-
-
-
-
-Press the shift key and hold it down until doShiftUp() is called or a new page is loaded.
-
-
-
-
-
-Release the shift key.
-
-
-
-
-
-Press the meta key and hold it down until doMetaUp() is called or a new page is loaded.
-
-
-
-
-
-Release the meta key.
-
-
-
-
-
-Press the alt key and hold it down until doAltUp() is called or a new page is loaded.
-
-
-
-
-
-Release the alt key.
-
-
-
-
-
-Press the control key and hold it down until doControlUp() is called or a new page is loaded.
-
-
-
-
-
-Release the control key.
-
-
-
-
-
-an element locator
-
-Either be a string("\" followed by the numeric keycode of the key to be pressed, normally the ASCII value of that key), or a single character. For example: "w", "\119".
-
-Simulates a user pressing a key (without releasing it yet).
-
-
-
-
-
-an element locator
-
-Either be a string("\" followed by the numeric keycode of the key to be pressed, normally the ASCII value of that key), or a single character. For example: "w", "\119".
-
-Simulates a user releasing a key.
-
-
-
-
-
-an element locator
-
-Simulates a user hovering a mouse over the specified element.
-
-
-
-
-
-an element locator
-
-Simulates a user moving the mouse pointer away from the specified element.
-
-
-
-
-
-an element locator
-
-Simulates a user pressing the left mouse button (without releasing it yet) on
-the specified element.
-
-
-
-
-
-an element locator
-
-Simulates a user pressing the right mouse button (without releasing it yet) on
-the specified element.
-
-
-
-
-
-an element locator
-
-specifies the x,y position (i.e. - 10,20) of the mouse event relative to the element returned by the locator.
-
-Simulates a user pressing the left mouse button (without releasing it yet) at
-the specified location.
-
-
-
-
-
-an element locator
-
-specifies the x,y position (i.e. - 10,20) of the mouse event relative to the element returned by the locator.
-
-Simulates a user pressing the right mouse button (without releasing it yet) at
-the specified location.
-
-
-
-
-
-an element locator
-
-Simulates the event that occurs when the user releases the mouse button (i.e., stops
-holding the button down) on the specified element.
-
-
-
-
-
-an element locator
-
-Simulates the event that occurs when the user releases the right mouse button (i.e., stops
-holding the button down) on the specified element.
-
-
-
-
-
-an element locator
-
-specifies the x,y position (i.e. - 10,20) of the mouse event relative to the element returned by the locator.
-
-Simulates the event that occurs when the user releases the mouse button (i.e., stops
-holding the button down) at the specified location.
-
-
-
-
-
-an element locator
-
-specifies the x,y position (i.e. - 10,20) of the mouse event relative to the element returned by the locator.
-
-Simulates the event that occurs when the user releases the right mouse button (i.e., stops
-holding the button down) at the specified location.
-
-
-
-
-
-an element locator
-
-Simulates a user pressing the mouse button (without releasing it yet) on
-the specified element.
-
-
-
-
-
-an element locator
-
-specifies the x,y position (i.e. - 10,20) of the mouse event relative to the element returned by the locator.
-
-Simulates a user pressing the mouse button (without releasing it yet) on
-the specified element.
-
-
-
-
-
-an element locator
-
-the value to type
-
-Sets the value of an input field, as though you typed it in.
-
-Can also be used to set the value of combo boxes, check boxes, etc. In these cases,
-value should be the value of the option selected, not the visible text.
-
-
-
-
-
-an element locator
-
-the value to type
-
-Simulates keystroke events on the specified element, as though you typed the value key-by-key.
-
-This is a convenience method for calling keyDown, keyUp, keyPress for every character in the specified string;
-this is useful for dynamic UI widgets (like auto-completing combo boxes) that require explicit key events.
-
-Unlike the simple "type" command, which forces the specified value into the page directly, this command
-may or may not have any visible effect, even in cases where typing keys would normally have a visible effect.
-For example, if you use "typeKeys" on a form element, you may or may not see the results of what you typed in
-the field.
-In some cases, you may need to use the simple "type" command to set the value of the field and then the "typeKeys" command to
-send the keystroke events corresponding to what you just typed.
-
-
-
-
-
-the number of milliseconds to pause after operation
-
-Set execution speed (i.e., set the millisecond length of a delay which will follow each selenium operation). By default, there is no such delay, i.e.,
-the delay is 0 milliseconds.
-
-
-
-
-
-the execution speed in milliseconds.
-
-Get execution speed (i.e., get the millisecond length of the delay following each selenium operation). By default, there is no such delay, i.e.,
-the delay is 0 milliseconds.
-
-See also setSpeed.
-
-
-
-
-
-an element locator
-
-Check a toggle-button (checkbox/radio)
-
-
-
-
-
-an element locator
-
-Uncheck a toggle-button (checkbox/radio)
-
-
-
-
-
-an element locator identifying a drop-down menu
-
-an option locator (a label by default)
-
-Select an option from a drop-down using an option locator.
-
-
-Option locators provide different ways of specifying options of an HTML
-Select element (e.g. for selecting a specific option, or for asserting
-that the selected option satisfies a specification). There are several
-forms of Select Option Locator.
-
-
-- label=labelPattern:
-matches options based on their labels, i.e. the visible text. (This
-is the default.)
-
-- label=regexp:^[Oo]ther
-
-
-- value=valuePattern:
-matches options based on their values.
-
-
-
-
-- id=id:
-
-matches options based on their ids.
-
-
-- index=index:
-matches an option based on its index (offset from zero).
-
-
-
-
-If no option locator prefix is provided, the default behaviour is to match on label.
-
-
-
-
-
-
-an element locator identifying a multi-select box
-
-an option locator (a label by default)
-
-Add a selection to the set of selected options in a multi-select element using an option locator.
-
-@see #doSelect for details of option locators
-
-
-
-
-
-an element locator identifying a multi-select box
-
-an option locator (a label by default)
-
-Remove a selection from the set of selected options in a multi-select element using an option locator.
-
-@see #doSelect for details of option locators
-
-
-
-
-
-an element locator identifying a multi-select box
-
-Unselects all of the selected options in a multi-select element.
-
-
-
-
-
-an element locator for the form you want to submit
-
-Submit the specified form. This is particularly useful for forms without
-submit buttons, e.g. single-input "Search" forms.
-
-
-
-
-
-the URL to open; may be relative or absolute
-
-Opens an URL in the test frame. This accepts both relative and absolute
-URLs.
-
-The "open" command waits for the page to load before proceeding,
-ie. the "AndWait" suffix is implicit.
-
-Note: The URL must be on the same domain as the runner HTML
-due to security restrictions in the browser (Same Origin Policy). If you
-need to open an URL on another domain, use the Selenium Server to start a
-new browser session on that domain.
-
-
-
-
-
-the URL to open, which can be blank
-
-the JavaScript window ID of the window to select
-
-Opens a popup window (if a window with that ID isn't already open).
-After opening the window, you'll need to select it using the selectWindow
-command.
-
-This command can also be a useful workaround for bug SEL-339. In some cases, Selenium will be unable to intercept a call to window.open (if the call occurs during or before the "onLoad" event, for example).
-In those cases, you can force Selenium to notice the open window's name by using the Selenium openWindow command, using
-an empty (blank) url, like this: openWindow("", "myFunnyWindow").
-
-
-
-
-
-the JavaScript window ID of the window to select
-
-Selects a popup window using a window locator; once a popup window has been selected, all
-commands go to that window. To select the main window again, use null
-as the target.
-
-
-
-Window locators provide different ways of specifying the window object:
-by title, by internal JavaScript "name," or by JavaScript variable.
-
-
-- title=My Special Window:
-Finds the window using the text that appears in the title bar. Be careful;
-two windows can share the same title. If that happens, this locator will
-just pick one.
-
-- name=myWindow:
-Finds the window using its internal JavaScript "name" property. This is the second
-parameter "windowName" passed to the JavaScript method window.open(url, windowName, windowFeatures, replaceFlag)
-(which Selenium intercepts).
-
-- var=variableName:
-Some pop-up windows are unnamed (anonymous), but are associated with a JavaScript variable name in the current
-application window, e.g. "window.foo = window.open(url);". In those cases, you can open the window using
-"var=foo".
-
-
-
-If no window locator prefix is provided, we'll try to guess what you mean like this:
-1.) if windowID is null, (or the string "null") then it is assumed the user is referring to the original window instantiated by the browser).
-2.) if the value of the "windowID" parameter is a JavaScript variable name in the current application window, then it is assumed
-that this variable contains the return value from a call to the JavaScript window.open() method.
-3.) Otherwise, selenium looks in a hash it maintains that maps string names to window "names".
-4.) If that fails, we'll try looping over all of the known windows to try to find the appropriate "title".
-Since "title" is not necessarily unique, this may have unexpected behavior.
-
-If you're having trouble figuring out the name of a window that you want to manipulate, look at the Selenium log messages
-which identify the names of windows created via window.open (and therefore intercepted by Selenium). You will see messages
-like the following for each window as it is opened:
-
-debug: window.open call intercepted; window ID (which you can use with selectWindow()) is "myNewWindow"
-
-In some cases, Selenium will be unable to intercept a call to window.open (if the call occurs during or before the "onLoad" event, for example).
-(This is bug SEL-339.) In those cases, you can force Selenium to notice the open window's name by using the Selenium openWindow command, using
-an empty (blank) url, like this: openWindow("", "myFunnyWindow").
-
-
-
-
-
-an element locator identifying a frame or iframe
-
-Selects a frame within the current window. (You may invoke this command
-multiple times to select nested frames.) To select the parent frame, use
-"relative=parent" as a locator; to select the top frame, use "relative=top".
-You can also select a frame by its 0-based index number; select the first frame with
-"index=0", or the third frame with "index=2".
-
-You may also use a DOM expression to identify the frame you want directly,
-like this: dom=frames["main"].frames["subframe"]
-
-
-
-
-
-true if the new frame is this code's window
-
-starting frame
-
-new frame (which might be relative to the current one)
-
-Determine whether current/locator identify the frame containing this running code.
-
-This is useful in proxy injection mode, where this code runs in every
-browser frame and window, and sometimes the selenium server needs to identify
-the "current" frame. In this case, when the test calls selectFrame, this
-routine is called for each frame to figure out which one has been selected.
-The selected frame will return true, while all others will return false.
-
-
-
-
-
-true if the new window is this code's window
-
-starting window
-
-new window (which might be relative to the current one, e.g., "_parent")
-
-Determine whether currentWindowString plus target identify the window containing this running code.
-
-This is useful in proxy injection mode, where this code runs in every
-browser frame and window, and sometimes the selenium server needs to identify
-the "current" window. In this case, when the test calls selectWindow, this
-routine is called for each window to figure out which one has been selected.
-The selected window will return true, while all others will return false.
-
-
-
-
-
-the JavaScript window "name" of the window that will appear (not the text of the title bar)
-
-a timeout in milliseconds, after which the action will return with an error
-
-Waits for a popup window to appear and load up.
-
-
-
-
-
-
-By default, Selenium's overridden window.confirm() function will
-return true, as if the user had manually clicked OK; after running
-this command, the next call to confirm() will return false, as if
-the user had clicked Cancel. Selenium will then resume using the
-default behavior for future confirmations, automatically returning
-true (OK) unless/until you explicitly call this command for each
-confirmation.
-
-
-Take note - every time a confirmation comes up, you must
-consume it with a corresponding getConfirmation, or else
-the next selenium operation will fail.
-
-
-
-
-
-
-
-Undo the effect of calling chooseCancelOnNextConfirmation. Note
-that Selenium's overridden window.confirm() function will normally automatically
-return true, as if the user had manually clicked OK, so you shouldn't
-need to use this command unless for some reason you need to change
-your mind prior to the next confirmation. After any confirmation, Selenium will resume using the
-default behavior for future confirmations, automatically returning
-true (OK) unless/until you explicitly call chooseCancelOnNextConfirmation for each
-confirmation.
-
-
-Take note - every time a confirmation comes up, you must
-consume it with a corresponding getConfirmation, or else
-the next selenium operation will fail.
-
-
-
-
-
-
-the answer to give in response to the prompt pop-up
-
-Instructs Selenium to return the specified answer string in response to
-the next JavaScript prompt [window.prompt()].
-
-
-
-
-
-Simulates the user clicking the "back" button on their browser.
-
-
-
-
-
-Simulates the user clicking the "Refresh" button on their browser.
-
-
-
-
-
-Simulates the user clicking the "close" button in the titlebar of a popup
-window or tab.
-
-
-
-
-
-true if there is an alert
-
-Has an alert occurred?
-
-
-This function never throws an exception
-
-
-
-
-
-
-true if there is a pending prompt
-
-Has a prompt occurred?
-
-
-This function never throws an exception
-
-
-
-
-
-
-true if there is a pending confirmation
-
-Has confirm() been called?
-
-
-This function never throws an exception
-
-
-
-
-
-
-The message of the most recent JavaScript alert
-
-Retrieves the message of a JavaScript alert generated during the previous action, or fail if there were no alerts.
-
-Getting an alert has the same effect as manually clicking OK. If an
-alert is generated but you do not consume it with getAlert, the next Selenium action
-will fail.
-
-Under Selenium, JavaScript alerts will NOT pop up a visible alert
-dialog.
-
-Selenium does NOT support JavaScript alerts that are generated in a
-page's onload() event handler. In this case a visible dialog WILL be
-generated and Selenium will hang until someone manually clicks OK.
-
-
-
-
-
-the message of the most recent JavaScript confirmation dialog
-
-Retrieves the message of a JavaScript confirmation dialog generated during
-the previous action.
-
-
-By default, the confirm function will return true, having the same effect
-as manually clicking OK. This can be changed by prior execution of the
-chooseCancelOnNextConfirmation command.
-
-
-If an confirmation is generated but you do not consume it with getConfirmation,
-the next Selenium action will fail.
-
-
-
-NOTE: under Selenium, JavaScript confirmations will NOT pop up a visible
-dialog.
-
-
-
-NOTE: Selenium does NOT support JavaScript confirmations that are
-generated in a page's onload() event handler. In this case a visible
-dialog WILL be generated and Selenium will hang until you manually click
-OK.
-
-
-
-
-
-
-the message of the most recent JavaScript question prompt
-
-Retrieves the message of a JavaScript question prompt dialog generated during
-the previous action.
-
-Successful handling of the prompt requires prior execution of the
-answerOnNextPrompt command. If a prompt is generated but you
-do not get/verify it, the next Selenium action will fail.
-
-NOTE: under Selenium, JavaScript prompts will NOT pop up a visible
-dialog.
-
-NOTE: Selenium does NOT support JavaScript prompts that are generated in a
-page's onload() event handler. In this case a visible dialog WILL be
-generated and Selenium will hang until someone manually clicks OK.
-
-
-
-
-
-the absolute URL of the current page
-
-Gets the absolute URL of the current page.
-
-
-
-
-
-the title of the current page
-
-Gets the title of the current page.
-
-
-
-
-
-the entire text of the page
-
-Gets the entire text of the page.
-
-
-
-
-
-the element value, or "on/off" for checkbox/radio elements
-
-an element locator
-
-Gets the (whitespace-trimmed) value of an input field (or anything else with a value parameter).
-For checkbox/radio elements, the value will be "on" or "off" depending on
-whether the element is checked or not.
-
-
-
-
-
-the text of the element
-
-an element locator
-
-Gets the text of an element. This works for any element that contains
-text. This command uses either the textContent (Mozilla-like browsers) or
-the innerText (IE-like browsers) of the element, which is the rendered
-text shown to the user.
-
-
-
-
-
-an element locator
-
-Briefly changes the backgroundColor of the specified element yellow. Useful for debugging.
-
-
-
-
-
-the results of evaluating the snippet
-
-the JavaScript snippet to run
-
-Gets the result of evaluating the specified JavaScript snippet. The snippet may
-have multiple lines, but only the result of the last line will be returned.
-
-Note that, by default, the snippet will run in the context of the "selenium"
-object itself, so this will refer to the Selenium object. Use window to
-refer to the window of your application, e.g. window.document.getElementById('foo')
-
-If you need to use
-a locator to refer to a single element in your application page, you can
-use this.browserbot.findElement("id=foo") where "id=foo" is your locator.
-
-
-
-
-
-true if the checkbox is checked, false otherwise
-
-an element locator pointing to a checkbox or radio button
-
-Gets whether a toggle-button (checkbox/radio) is checked. Fails if the specified element doesn't exist or isn't a toggle-button.
-
-
-
-
-
-the text from the specified cell
-
-a cell address, e.g. "foo.1.4"
-
-Gets the text from a cell of a table. The cellAddress syntax
-tableLocator.row.column, where row and column start at 0.
-
-
-
-
-
-an array of all selected option labels in the specified select drop-down
-
-an element locator identifying a drop-down menu
-
-Gets all option labels (visible text) for selected options in the specified select or multi-select element.
-
-
-
-
-
-the selected option label in the specified select drop-down
-
-an element locator identifying a drop-down menu
-
-Gets option label (visible text) for selected option in the specified select element.
-
-
-
-
-
-an array of all selected option values in the specified select drop-down
-
-an element locator identifying a drop-down menu
-
-Gets all option values (value attributes) for selected options in the specified select or multi-select element.
-
-
-
-
-
-the selected option value in the specified select drop-down
-
-an element locator identifying a drop-down menu
-
-Gets option value (value attribute) for selected option in the specified select element.
-
-
-
-
-
-an array of all selected option indexes in the specified select drop-down
-
-an element locator identifying a drop-down menu
-
-Gets all option indexes (option number, starting at 0) for selected options in the specified select or multi-select element.
-
-
-
-
-
-the selected option index in the specified select drop-down
-
-an element locator identifying a drop-down menu
-
-Gets option index (option number, starting at 0) for selected option in the specified select element.
-
-
-
-
-
-an array of all selected option IDs in the specified select drop-down
-
-an element locator identifying a drop-down menu
-
-Gets all option element IDs for selected options in the specified select or multi-select element.
-
-
-
-
-
-the selected option ID in the specified select drop-down
-
-an element locator identifying a drop-down menu
-
-Gets option element ID for selected option in the specified select element.
-
-
-
-
-
-true if some option has been selected, false otherwise
-
-an element locator identifying a drop-down menu
-
-Determines whether some option in a drop-down menu is selected.
-
-
-
-
-
-an array of all option labels in the specified select drop-down
-
-an element locator identifying a drop-down menu
-
-Gets all option labels in the specified select drop-down.
-
-
-
-
-
-the value of the specified attribute
-
-an element locator followed by an @ sign and then the name of the attribute, e.g. "foo@bar"
-
-Gets the value of an element attribute. The value of the attribute may
-differ across browsers (this is the case for the "style" attribute, for
-example).
-
-
-
-
-
-true if the pattern matches the text, false otherwise
-
-a pattern to match with the text of the page
-
-Verifies that the specified text pattern appears somewhere on the rendered page shown to the user.
-
-
-
-
-
-true if the element is present, false otherwise
-
-an element locator
-
-Verifies that the specified element is somewhere on the page.
-
-
-
-
-
-true if the specified element is visible, false otherwise
-
-an element locator
-
-Determines if the specified element is visible. An
-element can be rendered invisible by setting the CSS "visibility"
-property to "hidden", or the "display" property to "none", either for the
-element itself or one if its ancestors. This method will fail if
-the element is not present.
-
-
-
-
-
-true if the input element is editable, false otherwise
-
-an element locator
-
-Determines whether the specified input element is editable, ie hasn't been disabled.
-This method will fail if the specified element isn't an input element.
-
-
-
-
-
-the IDs of all buttons on the page
-
-Returns the IDs of all buttons on the page.
-
-If a given button has no ID, it will appear as "" in this array.
-
-
-
-
-
-the IDs of all links on the page
-
-Returns the IDs of all links on the page.
-
-If a given link has no ID, it will appear as "" in this array.
-
-
-
-
-
-the IDs of all field on the page
-
-Returns the IDs of all input fields on the page.
-
-If a given field has no ID, it will appear as "" in this array.
-
-
-
-
-
-the set of values of this attribute from all known windows.
-
-name of an attribute on the windows
-
-Returns every instance of some attribute from all known windows.
-
-
-
-
-
-an element locator
-
-offset in pixels from the current location to which the element should be moved, e.g., "+70,-300"
-
-deprecated - use dragAndDrop instead
-
-
-
-
-
-the number of pixels between "mousemove" events
-
-Configure the number of pixels between "mousemove" events during dragAndDrop commands (default=10).
-Setting this value to 0 means that we'll send a "mousemove" event to every single pixel
-in between the start location and the end location; that can be very slow, and may
-cause some browsers to force the JavaScript to timeout.
-
-If the mouse speed is greater than the distance between the two dragged objects, we'll
-just send one "mousemove" at the start location and then one final one at the end location.
-
-
-
-
-
-the number of pixels between "mousemove" events during dragAndDrop commands (default=10)
-
-Returns the number of pixels between "mousemove" events during dragAndDrop commands (default=10).
-
-
-
-
-
-an element locator
-
-offset in pixels from the current location to which the element should be moved, e.g., "+70,-300"
-
-Drags an element a certain distance and then drops it
-
-
-
-
-
-an element to be dragged
-
-an element whose location (i.e., whose center-most pixel) will be the point where locatorOfObjectToBeDragged is dropped
-
-Drags an element and drops it on another element
-
-
-
-
-
-Gives focus to the currently selected window
-
-
-
-
-
-Resize currently selected window to take up the entire screen
-
-
-
-
-
-the IDs of all windows that the browser knows about.
-
-Returns the IDs of all windows that the browser knows about.
-
-
-
-
-
-the names of all windows that the browser knows about.
-
-Returns the names of all windows that the browser knows about.
-
-
-
-
-
-the titles of all windows that the browser knows about.
-
-Returns the titles of all windows that the browser knows about.
-
-
-
-
-
-the entire HTML source
-
-Returns the entire HTML source between the opening and
-closing "html" tags.
-
-
-
-
-
-an element locator pointing to an input element or textarea
-
-the numerical position of the cursor in the field; position should be 0 to move the position to the beginning of the field. You can also set the cursor to -1 to move it to the end of the field.
-
-Moves the text cursor to the specified position in the given input element or textarea.
-This method will fail if the specified element isn't an input element or textarea.
-
-
-
-
-
-of relative index of the element to its parent (starting from 0)
-
-an element locator pointing to an element
-
-Get the relative index of an element to its parent (starting from 0). The comment node and empty text node
-will be ignored.
-
-
-
-
-
-true if element1 is the previous sibling of element2, false otherwise
-
-an element locator pointing to the first element
-
-an element locator pointing to the second element
-
-Check if these two elements have same parent and are ordered siblings in the DOM. Two same elements will
-not be considered ordered.
-
-
-
-
-
-of pixels from the edge of the frame.
-
-an element locator pointing to an element OR an element itself
-
-Retrieves the horizontal position of an element
-
-
-
-
-
-of pixels from the edge of the frame.
-
-an element locator pointing to an element OR an element itself
-
-Retrieves the vertical position of an element
-
-
-
-
-
-width of an element in pixels
-
-an element locator pointing to an element
-
-Retrieves the width of an element
-
-
-
-
-
-height of an element in pixels
-
-an element locator pointing to an element
-
-Retrieves the height of an element
-
-
-
-
-
-the numerical position of the cursor in the field
-
-an element locator pointing to an input element or textarea
-
-Retrieves the text cursor position in the given input element or textarea; beware, this may not work perfectly on all browsers.
-
-Specifically, if the cursor/selection has been cleared by JavaScript, this command will tend to
-return the position of the last location of the cursor, even though the cursor is now gone from the page. This is filed as SEL-243.
-This method will fail if the specified element isn't an input element or textarea, or there is no cursor in the element.
-
-
-
-
-
-the value passed in
-
-the value to return
-
-Returns the specified expression.
-
-This is useful because of JavaScript preprocessing.
-It is used to generate commands like assertExpression and waitForExpression.
-
-
-
-
-
-the number of nodes that match the specified xpath
-
-the xpath expression to evaluate. do NOT wrap this expression in a 'count()' function; we will do that for you.
-
-Returns the number of nodes that match the specified xpath, eg. "//table" would give
-the number of tables.
-
-
-
-
-
-an element locator pointing to an element
-
-a string to be used as the ID of the specified element
-
-Temporarily sets the "id" attribute of the specified element, so you can locate it in the future
-using its ID rather than a slow/complicated XPath. This ID will disappear once the page is
-reloaded.
-
-
-
-
-
-boolean, true means we'll prefer to use native XPath; false means we'll only use JS XPath
-
-Specifies whether Selenium should use the native in-browser implementation
-of XPath (if any native version is available); if you pass "false" to
-this function, we will always use our pure-JavaScript xpath library.
-Using the pure-JS xpath library can improve the consistency of xpath
-element locators between different browser vendors, but the pure-JS
-version is much slower than the native implementations.
-
-
-
-
-
-boolean, true means we'll ignore attributes without value at the expense of xpath "correctness"; false means we'll sacrifice speed for correctness.
-
-Specifies whether Selenium will ignore xpath attributes that have no
-value, i.e. are the empty string, when using the non-native xpath
-evaluation engine. You'd want to do this for performance reasons in IE.
-However, this could break certain xpaths, for example an xpath that looks
-for an attribute whose value is NOT the empty string.
-
-The hope is that such xpaths are relatively rare, but the user should
-have the option of using them. Note that this only influences xpath
-evaluation when using the ajaxslt engine (i.e. not "javascript-xpath").
-
-
-
-
-
-the JavaScript snippet to run
-
-a timeout in milliseconds, after which this command will return with an error
-
-Runs the specified JavaScript snippet repeatedly until it evaluates to "true".
-The snippet may have multiple lines, but only the result of the last line
-will be considered.
-
-Note that, by default, the snippet will be run in the runner's test window, not in the window
-of your application. To get the window of your application, you can use
-the JavaScript snippet selenium.browserbot.getCurrentWindow(), and then
-run your JavaScript in there
-
-
-
-
-
-a timeout in milliseconds, after which the action will return with an error
-
-Specifies the amount of time that Selenium will wait for actions to complete.
-
-Actions that require waiting include "open" and the "waitFor*" actions.
-The default timeout is 30 seconds.
-
-
-
-
-
-a timeout in milliseconds, after which this command will return with an error
-
-Waits for a new page to load.
-
-You can use this command instead of the "AndWait" suffixes, "clickAndWait", "selectAndWait", "typeAndWait" etc.
-(which are only available in the JS API).
-
-Selenium constantly keeps track of new pages loading, and sets a "newPageLoaded"
-flag when it first notices a page load. Running any other Selenium command after
-turns the flag to false. Hence, if you want to wait for a page to load, you must
-wait immediately after a Selenium command that caused a page-load.
-
-
-
-
-
-FrameAddress from the server side
-
-a timeout in milliseconds, after which this command will return with an error
-
-Waits for a new frame to load.
-
-Selenium constantly keeps track of new pages and frames loading,
-and sets a "newPageLoaded" flag when it first notices a page load.
-
-See waitForPageToLoad for more information.
-
-
-
-
-
-all cookies of the current page under test
-
-Return all cookies of the current page under test.
-
-
-
-
-
-the value of the cookie
-
-the name of the cookie
-
-Returns the value of the cookie with the specified name, or throws an error if the cookie is not present.
-
-
-
-
-
-true if a cookie with the specified name is present, or false otherwise.
-
-the name of the cookie
-
-Returns true if a cookie with the specified name is present, or false otherwise.
-
-
-
-
-
-name and value of the cookie in a format "name=value"
-
-options for the cookie. Currently supported options include 'path', 'max_age' and 'domain'. the optionsString's format is "path=/path/, max_age=60, domain=.foo.com". The order of options are irrelevant, the unit of the value of 'max_age' is second. Note that specifying a domain that isn't a subset of the current domain will usually fail.
-
-Create a new cookie whose path and domain are same with those of current page
-under test, unless you specified a path for this cookie explicitly.
-
-
-
-
-
-the name of the cookie to be deleted
-
-options for the cookie. Currently supported options include 'path', 'domain' and 'recurse.' The optionsString's format is "path=/path/, domain=.foo.com, recurse=true". The order of options are irrelevant. Note that specifying a domain that isn't a subset of the current domain will usually fail.
-
-Delete a named cookie with specified path and domain. Be careful; to delete a cookie, you
-need to delete it using the exact same path and domain that were used to create the cookie.
-If the path is wrong, or the domain is wrong, the cookie simply won't be deleted. Also
-note that specifying a domain that isn't a subset of the current domain will usually fail.
-
-Since there's no way to discover at runtime the original path and domain of a given cookie,
-we've added an option called 'recurse' to try all sub-domains of the current domain with
-all paths that are a subset of the current path. Beware; this option can be slow. In
-big-O notation, it operates in O(n*m) time, where n is the number of dots in the domain
-name and m is the number of slashes in the path.
-
-
-
-
-
-Calls deleteCookie with recurse=true on all cookies visible to the current page.
-As noted on the documentation for deleteCookie, recurse=true can be much slower
-than simply deleting the cookies using a known domain/path.
-
-
-
-
-
-one of the following: "debug", "info", "warn", "error" or "off"
-
-Sets the threshold for browser-side logging messages; log messages beneath this threshold will be discarded.
-Valid logLevel strings are: "debug", "info", "warn", "error" or "off".
-To see the browser logs, you need to
-either show the log window in GUI mode, or enable browser-side logging in Selenium RC.
-
-
-
-
-
-the JavaScript snippet to run
-
-Creates a new "script" tag in the body of the current test window, and
-adds the specified text into the body of the command. Scripts run in
-this way can often be debugged more easily than scripts executed using
-Selenium's "getEval" command. Beware that JS exceptions thrown in these script
-tags aren't managed by Selenium, so you should probably wrap your script
-in try/catch blocks if there is any chance that the script will throw
-an exception.
-
-
-
-
-
-the name of the strategy to define; this should use only letters [a-zA-Z] with no spaces or other punctuation.
-
-a string defining the body of a function in JavaScript. For example: return inDocument.getElementById(locator);
-
-Defines a new function for Selenium to locate elements on the page.
-For example,
-if you define the strategy "foo", and someone runs click("foo=blah"), we'll
-run your function, passing you the string "blah", and click on the element
-that your function
-returns, or throw an "Element not found" error if your function returns null.
-
-We'll pass three arguments to your function:
-
-- locator: the string the user passed in
-- inWindow: the currently selected window
-- inDocument: the currently selected document
-
-The function must return null if the element can't be found.
-
-
-
-
-
-the path to the file to persist the screenshot as. No filename extension will be appended by default. Directories will not be created if they do not exist, and an exception will be thrown, possibly by native code.
-
-a kwargs string that modifies the way the screenshot is captured. Example: "background=#CCFFDD" . Currently valid options: - background
- the background CSS for the HTML document. This may be useful to set for capturing screenshots of less-than-ideal layouts, for example where absolute positioning causes the calculation of the canvas dimension to fail and a black background is exposed (possibly obscuring black text).
-
-Saves the entire contents of the current window canvas to a PNG file.
-Contrast this with the captureScreenshot command, which captures the
-contents of the OS viewport (i.e. whatever is currently being displayed
-on the monitor), and is implemented in the RC only. Currently this only
-works in Firefox when running in chrome mode, and in IE non-HTA using
-the EXPERIMENTAL "Snapsie" utility. The Firefox implementation is mostly
-borrowed from the Screengrab! Firefox extension. Please see
-http://www.screengrab.org and http://snapsie.sourceforge.net/ for
-details.
-
-
-
-
-
-the name of the rollup command
-
-keyword arguments string that influences how the rollup expands into commands
-
-Executes a command rollup, which is a series of commands with a unique
-name, and optionally arguments that control the generation of the set of
-commands. If any one of the rolled-up commands fails, the rollup is
-considered to have failed. Rollups may also contain nested rollups.
-
-
-
-
-
-the Javascript content of the script to add
-
-(optional) the id of the new script tag. If specified, and an element with this id already exists, this operation will fail.
-
-Loads script content into a new script tag in the Selenium document. This
-differs from the runScript command in that runScript adds the script tag
-to the document of the AUT, not the Selenium document. The following
-entities in the script content are replaced by the characters they
-represent:
-
- <
- >
- &
-
-The corresponding remove command is removeScript.
-
-
-
-
-
-the id of the script element to remove.
-
-Removes a script tag from the Selenium document identified by the given
-id. Does nothing if the referenced tag doesn't exist.
-
-
-
-
-
-name of the desired library Only the following three can be chosen: ajaxslt - Google's library javascript - Cybozu Labs' faster library default - The default library. Currently the default library is ajaxslt. If libraryName isn't one of these three, then no change will be made.
-
-Allows choice of one of the available libraries.
-
-
-
-
-
-the amount of time to sleep (in milliseconds)
-
-Wait for the specified amount of time (in milliseconds)
-
-
-
-
-
-Halt the currently running test, and wait for the user to press the Continue button.
-This command is useful for debugging, but be careful when using it, because it will
-force automated tests to hang until a user intervenes manually.
-
-
-
-
-
-the value to store
-
-the name of a variable in which the result is to be stored.
-
-This command is a synonym for storeExpression.
-
-
-
-
-
-the message to print
-
-Prints the specified message into the third table cell in your Selenese tables.
-Useful for debugging.
-
-
-
-
-
-an element locator identifying a drop-down menu
-
-an option locator, typically just an option label (e.g. "John Smith")
-
-Verifies that the selected option of a drop-down satisfies the optionSpecifier. Note that this command is deprecated; you should use assertSelectedLabel, assertSelectedValue, assertSelectedIndex, or assertSelectedId instead.
-
-See the select command for more information about option locators.
-
-
-
-
-
-The failure message we should expect. This command will fail if the wrong failure message appears.
-
-Tell Selenium to expect a failure on the next command execution.
-
-
-
-
-
-The error message we should expect. This command will fail if the wrong error message appears.
-
-Tell Selenium to expect an error on the next command execution.
-
-
-
-
diff --git a/vendor/plugins/selenium-on-rails/selenium-core/iedoc.xml b/vendor/plugins/selenium-on-rails/selenium-core/iedoc.xml
deleted file mode 100644
index 0b9f7a74..00000000
--- a/vendor/plugins/selenium-on-rails/selenium-core/iedoc.xml
+++ /dev/null
@@ -1,1800 +0,0 @@
-
-
-
-
-Defines an object that runs Selenium commands.
-
-Element Locators
-
-Element Locators tell Selenium which HTML element a command refers to.
-The format of a locator is:
-
-locatorType=argument
-
-
-
-We support the following strategies for locating elements:
-
-
-
-- identifier=id:
-Select the element with the specified @id attribute. If no match is
-found, select the first element whose @name attribute is id.
-(This is normally the default; see below.)
-- id=id:
-Select the element with the specified @id attribute.
-
-- name=name:
-Select the first element with the specified @name attribute.
-
-- username
-- name=username
-
-
-The name may optionally be followed by one or more element-filters, separated from the name by whitespace. If the filterType is not specified, value is assumed.
-
-
-- name=flavour value=chocolate
-
-
-- dom=javascriptExpression:
-
-Find an element by evaluating the specified string. This allows you to traverse the HTML Document Object
-Model using JavaScript. Note that you must not return a value in this string; simply make it the last expression in the block.
-
-- dom=document.forms['myForm'].myDropdown
-- dom=document.images[56]
-- dom=function foo() { return document.links[1]; }; foo();
-
-
-
-
-- xpath=xpathExpression:
-Locate an element using an XPath expression.
-
-- xpath=//img[@alt='The image alt text']
-- xpath=//table[@id='table1']//tr[4]/td[2]
-- xpath=//a[contains(@href,'#id1')]
-- xpath=//a[contains(@href,'#id1')]/@class
-- xpath=(//table[@class='stylee'])//th[text()='theHeaderText']/../td
-- xpath=//input[@name='name2' and @value='yes']
-- xpath=//*[text()="right"]
-
-
-
-- link=textPattern:
-Select the link (anchor) element which contains text matching the
-specified pattern.
-
-
-
-
-- css=cssSelectorSyntax:
-Select the element using css selectors. Please refer to CSS2 selectors, CSS3 selectors for more information. You can also check the TestCssLocators test in the selenium test suite for an example of usage, which is included in the downloaded selenium core package.
-
-- css=a[href="#id3"]
-- css=span#firstChild + span
-
-Currently the css selector locator supports all css1, css2 and css3 selectors except namespace in css3, some pseudo classes(:nth-of-type, :nth-last-of-type, :first-of-type, :last-of-type, :only-of-type, :visited, :hover, :active, :focus, :indeterminate) and pseudo elements(::first-line, ::first-letter, ::selection, ::before, ::after).
-
-
-- ui=uiSpecifierString:
-Locate an element by resolving the UI specifier string to another locator, and evaluating it. See the Selenium UI-Element Reference for more details.
-
-- ui=loginPages::loginButton()
-- ui=settingsPages::toggle(label=Hide Email)
-- ui=forumPages::postBody(index=2)//a[2]
-
-
-
-
-
-
-Without an explicit locator prefix, Selenium uses the following default
-strategies:
-
-
-
-- dom, for locators starting with "document."
-- xpath, for locators starting with "//"
-- identifier, otherwise
-
-
-
-
-Element filters can be used with a locator to refine a list of candidate elements. They are currently used only in the 'name' element-locator.
-Filters look much like locators, ie.
-
-filterType=argument
-
-Supported element-filters are:
-value=valuePattern
-
-Matches elements based on their values. This is particularly useful for refining a list of similarly-named toggle-buttons.
-index=index
-
-Selects a single element based on its position in the list (offset from zero).
-
-
-String-match Patterns
-
-
-Various Pattern syntaxes are available for matching string values:
-
-
-- glob:pattern:
-Match a string against a "glob" (aka "wildmat") pattern. "Glob" is a
-kind of limited regular-expression syntax typically used in command-line
-shells. In a glob pattern, "*" represents any sequence of characters, and "?"
-represents any single character. Glob patterns match against the entire
-string.
-- regexp:regexp:
-Match a string using a regular-expression. The full power of JavaScript
-regular-expressions is available.
-- regexpi:regexpi:
-Match a string using a case-insensitive regular-expression.
-- exact:string:
-
-Match a string exactly, verbatim, without any of that fancy wildcard
-stuff.
-
-
-If no pattern prefix is specified, Selenium assumes that it's a "glob"
-pattern.
-
-
-For commands that return multiple values (such as verifySelectOptions),
-the string being matched is a comma-separated list of the return values,
-where both commas and backslashes in the values are backslash-escaped.
-When providing a pattern, the optional matching syntax (i.e. glob,
-regexp, etc.) is specified once, as usual, at the beginning of the
-pattern.
-
-
-
-
-an element locator
-
-Clicks on a link, button, checkbox or radio button. If the click action
-causes a new page to load (like a link usually does), call
-waitForPageToLoad.
-
-
-
-
-
-an element locator
-
-Double clicks on a link, button, checkbox or radio button. If the double click action
-causes a new page to load (like a link usually does), call
-waitForPageToLoad.
-
-
-
-
-
-an element locator
-
-Simulates opening the context menu for the specified element (as might happen if the user "right-clicked" on the element).
-
-
-
-
-
-an element locator
-
-specifies the x,y position (i.e. - 10,20) of the mouse event relative to the element returned by the locator.
-
-Clicks on a link, button, checkbox or radio button. If the click action
-causes a new page to load (like a link usually does), call
-waitForPageToLoad.
-
-
-
-
-
-an element locator
-
-specifies the x,y position (i.e. - 10,20) of the mouse event relative to the element returned by the locator.
-
-Doubleclicks on a link, button, checkbox or radio button. If the action
-causes a new page to load (like a link usually does), call
-waitForPageToLoad.
-
-
-
-
-
-an element locator
-
-specifies the x,y position (i.e. - 10,20) of the mouse event relative to the element returned by the locator.
-
-Simulates opening the context menu for the specified element (as might happen if the user "right-clicked" on the element).
-
-
-
-
-
-an element locator
-
-the event name, e.g. "focus" or "blur"
-
-Explicitly simulate an event, to trigger the corresponding "onevent"
-handler.
-
-
-
-
-
-an element locator
-
-Move the focus to the specified element; for example, if the element is an input field, move the cursor to that field.
-
-
-
-
-
-an element locator
-
-Either be a string("\" followed by the numeric keycode of the key to be pressed, normally the ASCII value of that key), or a single character. For example: "w", "\119".
-
-Simulates a user pressing and releasing a key.
-
-
-
-
-
-Press the shift key and hold it down until doShiftUp() is called or a new page is loaded.
-
-
-
-
-
-Release the shift key.
-
-
-
-
-
-Press the meta key and hold it down until doMetaUp() is called or a new page is loaded.
-
-
-
-
-
-Release the meta key.
-
-
-
-
-
-Press the alt key and hold it down until doAltUp() is called or a new page is loaded.
-
-
-
-
-
-Release the alt key.
-
-
-
-
-
-Press the control key and hold it down until doControlUp() is called or a new page is loaded.
-
-
-
-
-
-Release the control key.
-
-
-
-
-
-an element locator
-
-Either be a string("\" followed by the numeric keycode of the key to be pressed, normally the ASCII value of that key), or a single character. For example: "w", "\119".
-
-Simulates a user pressing a key (without releasing it yet).
-
-
-
-
-
-an element locator
-
-Either be a string("\" followed by the numeric keycode of the key to be pressed, normally the ASCII value of that key), or a single character. For example: "w", "\119".
-
-Simulates a user releasing a key.
-
-
-
-
-
-an element locator
-
-Simulates a user hovering a mouse over the specified element.
-
-
-
-
-
-an element locator
-
-Simulates a user moving the mouse pointer away from the specified element.
-
-
-
-
-
-an element locator
-
-Simulates a user pressing the left mouse button (without releasing it yet) on
-the specified element.
-
-
-
-
-
-an element locator
-
-Simulates a user pressing the right mouse button (without releasing it yet) on
-the specified element.
-
-
-
-
-
-an element locator
-
-specifies the x,y position (i.e. - 10,20) of the mouse event relative to the element returned by the locator.
-
-Simulates a user pressing the left mouse button (without releasing it yet) at
-the specified location.
-
-
-
-
-
-an element locator
-
-specifies the x,y position (i.e. - 10,20) of the mouse event relative to the element returned by the locator.
-
-Simulates a user pressing the right mouse button (without releasing it yet) at
-the specified location.
-
-
-
-
-
-an element locator
-
-Simulates the event that occurs when the user releases the mouse button (i.e., stops
-holding the button down) on the specified element.
-
-
-
-
-
-an element locator
-
-Simulates the event that occurs when the user releases the right mouse button (i.e., stops
-holding the button down) on the specified element.
-
-
-
-
-
-an element locator
-
-specifies the x,y position (i.e. - 10,20) of the mouse event relative to the element returned by the locator.
-
-Simulates the event that occurs when the user releases the mouse button (i.e., stops
-holding the button down) at the specified location.
-
-
-
-
-
-an element locator
-
-specifies the x,y position (i.e. - 10,20) of the mouse event relative to the element returned by the locator.
-
-Simulates the event that occurs when the user releases the right mouse button (i.e., stops
-holding the button down) at the specified location.
-
-
-
-
-
-an element locator
-
-Simulates a user pressing the mouse button (without releasing it yet) on
-the specified element.
-
-
-
-
-
-an element locator
-
-specifies the x,y position (i.e. - 10,20) of the mouse event relative to the element returned by the locator.
-
-Simulates a user pressing the mouse button (without releasing it yet) on
-the specified element.
-
-
-
-
-
-an element locator
-
-the value to type
-
-Sets the value of an input field, as though you typed it in.
-
-Can also be used to set the value of combo boxes, check boxes, etc. In these cases,
-value should be the value of the option selected, not the visible text.
-
-
-
-
-
-an element locator
-
-the value to type
-
-Simulates keystroke events on the specified element, as though you typed the value key-by-key.
-
-This is a convenience method for calling keyDown, keyUp, keyPress for every character in the specified string;
-this is useful for dynamic UI widgets (like auto-completing combo boxes) that require explicit key events.
-
-Unlike the simple "type" command, which forces the specified value into the page directly, this command
-may or may not have any visible effect, even in cases where typing keys would normally have a visible effect.
-For example, if you use "typeKeys" on a form element, you may or may not see the results of what you typed in
-the field.
-In some cases, you may need to use the simple "type" command to set the value of the field and then the "typeKeys" command to
-send the keystroke events corresponding to what you just typed.
-
-
-
-
-
-the number of milliseconds to pause after operation
-
-Set execution speed (i.e., set the millisecond length of a delay which will follow each selenium operation). By default, there is no such delay, i.e.,
-the delay is 0 milliseconds.
-
-
-
-
-
-the execution speed in milliseconds.
-
-Get execution speed (i.e., get the millisecond length of the delay following each selenium operation). By default, there is no such delay, i.e.,
-the delay is 0 milliseconds.
-
-See also setSpeed.
-
-
-
-
-
-an element locator
-
-Check a toggle-button (checkbox/radio)
-
-
-
-
-
-an element locator
-
-Uncheck a toggle-button (checkbox/radio)
-
-
-
-
-
-an element locator identifying a drop-down menu
-
-an option locator (a label by default)
-
-Select an option from a drop-down using an option locator.
-
-
-Option locators provide different ways of specifying options of an HTML
-Select element (e.g. for selecting a specific option, or for asserting
-that the selected option satisfies a specification). There are several
-forms of Select Option Locator.
-
-
-- label=labelPattern:
-matches options based on their labels, i.e. the visible text. (This
-is the default.)
-
-- label=regexp:^[Oo]ther
-
-
-- value=valuePattern:
-matches options based on their values.
-
-
-
-
-- id=id:
-
-matches options based on their ids.
-
-
-- index=index:
-matches an option based on its index (offset from zero).
-
-
-
-
-If no option locator prefix is provided, the default behaviour is to match on label.
-
-
-
-
-
-
-an element locator identifying a multi-select box
-
-an option locator (a label by default)
-
-Add a selection to the set of selected options in a multi-select element using an option locator.
-
-@see #doSelect for details of option locators
-
-
-
-
-
-an element locator identifying a multi-select box
-
-an option locator (a label by default)
-
-Remove a selection from the set of selected options in a multi-select element using an option locator.
-
-@see #doSelect for details of option locators
-
-
-
-
-
-an element locator identifying a multi-select box
-
-Unselects all of the selected options in a multi-select element.
-
-
-
-
-
-an element locator for the form you want to submit
-
-Submit the specified form. This is particularly useful for forms without
-submit buttons, e.g. single-input "Search" forms.
-
-
-
-
-
-the URL to open; may be relative or absolute
-
-Opens an URL in the test frame. This accepts both relative and absolute
-URLs.
-
-The "open" command waits for the page to load before proceeding,
-ie. the "AndWait" suffix is implicit.
-
-Note: The URL must be on the same domain as the runner HTML
-due to security restrictions in the browser (Same Origin Policy). If you
-need to open an URL on another domain, use the Selenium Server to start a
-new browser session on that domain.
-
-
-
-
-
-the URL to open, which can be blank
-
-the JavaScript window ID of the window to select
-
-Opens a popup window (if a window with that ID isn't already open).
-After opening the window, you'll need to select it using the selectWindow
-command.
-
-This command can also be a useful workaround for bug SEL-339. In some cases, Selenium will be unable to intercept a call to window.open (if the call occurs during or before the "onLoad" event, for example).
-In those cases, you can force Selenium to notice the open window's name by using the Selenium openWindow command, using
-an empty (blank) url, like this: openWindow("", "myFunnyWindow").
-
-
-
-
-
-the JavaScript window ID of the window to select
-
-Selects a popup window using a window locator; once a popup window has been selected, all
-commands go to that window. To select the main window again, use null
-as the target.
-
-
-
-Window locators provide different ways of specifying the window object:
-by title, by internal JavaScript "name," or by JavaScript variable.
-
-
-- title=My Special Window:
-Finds the window using the text that appears in the title bar. Be careful;
-two windows can share the same title. If that happens, this locator will
-just pick one.
-
-- name=myWindow:
-Finds the window using its internal JavaScript "name" property. This is the second
-parameter "windowName" passed to the JavaScript method window.open(url, windowName, windowFeatures, replaceFlag)
-(which Selenium intercepts).
-
-- var=variableName:
-Some pop-up windows are unnamed (anonymous), but are associated with a JavaScript variable name in the current
-application window, e.g. "window.foo = window.open(url);". In those cases, you can open the window using
-"var=foo".
-
-
-
-If no window locator prefix is provided, we'll try to guess what you mean like this:
-1.) if windowID is null, (or the string "null") then it is assumed the user is referring to the original window instantiated by the browser).
-2.) if the value of the "windowID" parameter is a JavaScript variable name in the current application window, then it is assumed
-that this variable contains the return value from a call to the JavaScript window.open() method.
-3.) Otherwise, selenium looks in a hash it maintains that maps string names to window "names".
-4.) If that fails, we'll try looping over all of the known windows to try to find the appropriate "title".
-Since "title" is not necessarily unique, this may have unexpected behavior.
-
-If you're having trouble figuring out the name of a window that you want to manipulate, look at the Selenium log messages
-which identify the names of windows created via window.open (and therefore intercepted by Selenium). You will see messages
-like the following for each window as it is opened:
-
-debug: window.open call intercepted; window ID (which you can use with selectWindow()) is "myNewWindow"
-
-In some cases, Selenium will be unable to intercept a call to window.open (if the call occurs during or before the "onLoad" event, for example).
-(This is bug SEL-339.) In those cases, you can force Selenium to notice the open window's name by using the Selenium openWindow command, using
-an empty (blank) url, like this: openWindow("", "myFunnyWindow").
-
-
-
-
-
-an element locator identifying a frame or iframe
-
-Selects a frame within the current window. (You may invoke this command
-multiple times to select nested frames.) To select the parent frame, use
-"relative=parent" as a locator; to select the top frame, use "relative=top".
-You can also select a frame by its 0-based index number; select the first frame with
-"index=0", or the third frame with "index=2".
-
-You may also use a DOM expression to identify the frame you want directly,
-like this: dom=frames["main"].frames["subframe"]
-
-
-
-
-
-true if the new frame is this code's window
-
-starting frame
-
-new frame (which might be relative to the current one)
-
-Determine whether current/locator identify the frame containing this running code.
-
-This is useful in proxy injection mode, where this code runs in every
-browser frame and window, and sometimes the selenium server needs to identify
-the "current" frame. In this case, when the test calls selectFrame, this
-routine is called for each frame to figure out which one has been selected.
-The selected frame will return true, while all others will return false.
-
-
-
-
-
-true if the new window is this code's window
-
-starting window
-
-new window (which might be relative to the current one, e.g., "_parent")
-
-Determine whether currentWindowString plus target identify the window containing this running code.
-
-This is useful in proxy injection mode, where this code runs in every
-browser frame and window, and sometimes the selenium server needs to identify
-the "current" window. In this case, when the test calls selectWindow, this
-routine is called for each window to figure out which one has been selected.
-The selected window will return true, while all others will return false.
-
-
-
-
-
-the JavaScript window "name" of the window that will appear (not the text of the title bar)
-
-a timeout in milliseconds, after which the action will return with an error
-
-Waits for a popup window to appear and load up.
-
-
-
-
-
-
-By default, Selenium's overridden window.confirm() function will
-return true, as if the user had manually clicked OK; after running
-this command, the next call to confirm() will return false, as if
-the user had clicked Cancel. Selenium will then resume using the
-default behavior for future confirmations, automatically returning
-true (OK) unless/until you explicitly call this command for each
-confirmation.
-
-
-Take note - every time a confirmation comes up, you must
-consume it with a corresponding getConfirmation, or else
-the next selenium operation will fail.
-
-
-
-
-
-
-
-Undo the effect of calling chooseCancelOnNextConfirmation. Note
-that Selenium's overridden window.confirm() function will normally automatically
-return true, as if the user had manually clicked OK, so you shouldn't
-need to use this command unless for some reason you need to change
-your mind prior to the next confirmation. After any confirmation, Selenium will resume using the
-default behavior for future confirmations, automatically returning
-true (OK) unless/until you explicitly call chooseCancelOnNextConfirmation for each
-confirmation.
-
-
-Take note - every time a confirmation comes up, you must
-consume it with a corresponding getConfirmation, or else
-the next selenium operation will fail.
-
-
-
-
-
-
-the answer to give in response to the prompt pop-up
-
-Instructs Selenium to return the specified answer string in response to
-the next JavaScript prompt [window.prompt()].
-
-
-
-
-
-Simulates the user clicking the "back" button on their browser.
-
-
-
-
-
-Simulates the user clicking the "Refresh" button on their browser.
-
-
-
-
-
-Simulates the user clicking the "close" button in the titlebar of a popup
-window or tab.
-
-
-
-
-
-true if there is an alert
-
-Has an alert occurred?
-
-
-This function never throws an exception
-
-
-
-
-
-
-true if there is a pending prompt
-
-Has a prompt occurred?
-
-
-This function never throws an exception
-
-
-
-
-
-
-true if there is a pending confirmation
-
-Has confirm() been called?
-
-
-This function never throws an exception
-
-
-
-
-
-
-The message of the most recent JavaScript alert
-
-Retrieves the message of a JavaScript alert generated during the previous action, or fail if there were no alerts.
-
-Getting an alert has the same effect as manually clicking OK. If an
-alert is generated but you do not consume it with getAlert, the next Selenium action
-will fail.
-
-Under Selenium, JavaScript alerts will NOT pop up a visible alert
-dialog.
-
-Selenium does NOT support JavaScript alerts that are generated in a
-page's onload() event handler. In this case a visible dialog WILL be
-generated and Selenium will hang until someone manually clicks OK.
-
-
-
-
-
-the message of the most recent JavaScript confirmation dialog
-
-Retrieves the message of a JavaScript confirmation dialog generated during
-the previous action.
-
-
-By default, the confirm function will return true, having the same effect
-as manually clicking OK. This can be changed by prior execution of the
-chooseCancelOnNextConfirmation command.
-
-
-If an confirmation is generated but you do not consume it with getConfirmation,
-the next Selenium action will fail.
-
-
-
-NOTE: under Selenium, JavaScript confirmations will NOT pop up a visible
-dialog.
-
-
-
-NOTE: Selenium does NOT support JavaScript confirmations that are
-generated in a page's onload() event handler. In this case a visible
-dialog WILL be generated and Selenium will hang until you manually click
-OK.
-
-
-
-
-
-
-the message of the most recent JavaScript question prompt
-
-Retrieves the message of a JavaScript question prompt dialog generated during
-the previous action.
-
-Successful handling of the prompt requires prior execution of the
-answerOnNextPrompt command. If a prompt is generated but you
-do not get/verify it, the next Selenium action will fail.
-
-NOTE: under Selenium, JavaScript prompts will NOT pop up a visible
-dialog.
-
-NOTE: Selenium does NOT support JavaScript prompts that are generated in a
-page's onload() event handler. In this case a visible dialog WILL be
-generated and Selenium will hang until someone manually clicks OK.
-
-
-
-
-
-the absolute URL of the current page
-
-Gets the absolute URL of the current page.
-
-
-
-
-
-the title of the current page
-
-Gets the title of the current page.
-
-
-
-
-
-the entire text of the page
-
-Gets the entire text of the page.
-
-
-
-
-
-the element value, or "on/off" for checkbox/radio elements
-
-an element locator
-
-Gets the (whitespace-trimmed) value of an input field (or anything else with a value parameter).
-For checkbox/radio elements, the value will be "on" or "off" depending on
-whether the element is checked or not.
-
-
-
-
-
-the text of the element
-
-an element locator
-
-Gets the text of an element. This works for any element that contains
-text. This command uses either the textContent (Mozilla-like browsers) or
-the innerText (IE-like browsers) of the element, which is the rendered
-text shown to the user.
-
-
-
-
-
-an element locator
-
-Briefly changes the backgroundColor of the specified element yellow. Useful for debugging.
-
-
-
-
-
-the results of evaluating the snippet
-
-the JavaScript snippet to run
-
-Gets the result of evaluating the specified JavaScript snippet. The snippet may
-have multiple lines, but only the result of the last line will be returned.
-
-Note that, by default, the snippet will run in the context of the "selenium"
-object itself, so this will refer to the Selenium object. Use window to
-refer to the window of your application, e.g. window.document.getElementById('foo')
-
-If you need to use
-a locator to refer to a single element in your application page, you can
-use this.browserbot.findElement("id=foo") where "id=foo" is your locator.
-
-
-
-
-
-true if the checkbox is checked, false otherwise
-
-an element locator pointing to a checkbox or radio button
-
-Gets whether a toggle-button (checkbox/radio) is checked. Fails if the specified element doesn't exist or isn't a toggle-button.
-
-
-
-
-
-the text from the specified cell
-
-a cell address, e.g. "foo.1.4"
-
-Gets the text from a cell of a table. The cellAddress syntax
-tableLocator.row.column, where row and column start at 0.
-
-
-
-
-
-an array of all selected option labels in the specified select drop-down
-
-an element locator identifying a drop-down menu
-
-Gets all option labels (visible text) for selected options in the specified select or multi-select element.
-
-
-
-
-
-the selected option label in the specified select drop-down
-
-an element locator identifying a drop-down menu
-
-Gets option label (visible text) for selected option in the specified select element.
-
-
-
-
-
-an array of all selected option values in the specified select drop-down
-
-an element locator identifying a drop-down menu
-
-Gets all option values (value attributes) for selected options in the specified select or multi-select element.
-
-
-
-
-
-the selected option value in the specified select drop-down
-
-an element locator identifying a drop-down menu
-
-Gets option value (value attribute) for selected option in the specified select element.
-
-
-
-
-
-an array of all selected option indexes in the specified select drop-down
-
-an element locator identifying a drop-down menu
-
-Gets all option indexes (option number, starting at 0) for selected options in the specified select or multi-select element.
-
-
-
-
-
-the selected option index in the specified select drop-down
-
-an element locator identifying a drop-down menu
-
-Gets option index (option number, starting at 0) for selected option in the specified select element.
-
-
-
-
-
-an array of all selected option IDs in the specified select drop-down
-
-an element locator identifying a drop-down menu
-
-Gets all option element IDs for selected options in the specified select or multi-select element.
-
-
-
-
-
-the selected option ID in the specified select drop-down
-
-an element locator identifying a drop-down menu
-
-Gets option element ID for selected option in the specified select element.
-
-
-
-
-
-true if some option has been selected, false otherwise
-
-an element locator identifying a drop-down menu
-
-Determines whether some option in a drop-down menu is selected.
-
-
-
-
-
-an array of all option labels in the specified select drop-down
-
-an element locator identifying a drop-down menu
-
-Gets all option labels in the specified select drop-down.
-
-
-
-
-
-the value of the specified attribute
-
-an element locator followed by an @ sign and then the name of the attribute, e.g. "foo@bar"
-
-Gets the value of an element attribute. The value of the attribute may
-differ across browsers (this is the case for the "style" attribute, for
-example).
-
-
-
-
-
-true if the pattern matches the text, false otherwise
-
-a pattern to match with the text of the page
-
-Verifies that the specified text pattern appears somewhere on the rendered page shown to the user.
-
-
-
-
-
-true if the element is present, false otherwise
-
-an element locator
-
-Verifies that the specified element is somewhere on the page.
-
-
-
-
-
-true if the specified element is visible, false otherwise
-
-an element locator
-
-Determines if the specified element is visible. An
-element can be rendered invisible by setting the CSS "visibility"
-property to "hidden", or the "display" property to "none", either for the
-element itself or one if its ancestors. This method will fail if
-the element is not present.
-
-
-
-
-
-true if the input element is editable, false otherwise
-
-an element locator
-
-Determines whether the specified input element is editable, ie hasn't been disabled.
-This method will fail if the specified element isn't an input element.
-
-
-
-
-
-the IDs of all buttons on the page
-
-Returns the IDs of all buttons on the page.
-
-If a given button has no ID, it will appear as "" in this array.
-
-
-
-
-
-the IDs of all links on the page
-
-Returns the IDs of all links on the page.
-
-If a given link has no ID, it will appear as "" in this array.
-
-
-
-
-
-the IDs of all field on the page
-
-Returns the IDs of all input fields on the page.
-
-If a given field has no ID, it will appear as "" in this array.
-
-
-
-
-
-the set of values of this attribute from all known windows.
-
-name of an attribute on the windows
-
-Returns every instance of some attribute from all known windows.
-
-
-
-
-
-an element locator
-
-offset in pixels from the current location to which the element should be moved, e.g., "+70,-300"
-
-deprecated - use dragAndDrop instead
-
-
-
-
-
-the number of pixels between "mousemove" events
-
-Configure the number of pixels between "mousemove" events during dragAndDrop commands (default=10).
-Setting this value to 0 means that we'll send a "mousemove" event to every single pixel
-in between the start location and the end location; that can be very slow, and may
-cause some browsers to force the JavaScript to timeout.
-
-If the mouse speed is greater than the distance between the two dragged objects, we'll
-just send one "mousemove" at the start location and then one final one at the end location.
-
-
-
-
-
-the number of pixels between "mousemove" events during dragAndDrop commands (default=10)
-
-Returns the number of pixels between "mousemove" events during dragAndDrop commands (default=10).
-
-
-
-
-
-an element locator
-
-offset in pixels from the current location to which the element should be moved, e.g., "+70,-300"
-
-Drags an element a certain distance and then drops it
-
-
-
-
-
-an element to be dragged
-
-an element whose location (i.e., whose center-most pixel) will be the point where locatorOfObjectToBeDragged is dropped
-
-Drags an element and drops it on another element
-
-
-
-
-
-Gives focus to the currently selected window
-
-
-
-
-
-Resize currently selected window to take up the entire screen
-
-
-
-
-
-the IDs of all windows that the browser knows about.
-
-Returns the IDs of all windows that the browser knows about.
-
-
-
-
-
-the names of all windows that the browser knows about.
-
-Returns the names of all windows that the browser knows about.
-
-
-
-
-
-the titles of all windows that the browser knows about.
-
-Returns the titles of all windows that the browser knows about.
-
-
-
-
-
-the entire HTML source
-
-Returns the entire HTML source between the opening and
-closing "html" tags.
-
-
-
-
-
-an element locator pointing to an input element or textarea
-
-the numerical position of the cursor in the field; position should be 0 to move the position to the beginning of the field. You can also set the cursor to -1 to move it to the end of the field.
-
-Moves the text cursor to the specified position in the given input element or textarea.
-This method will fail if the specified element isn't an input element or textarea.
-
-
-
-
-
-of relative index of the element to its parent (starting from 0)
-
-an element locator pointing to an element
-
-Get the relative index of an element to its parent (starting from 0). The comment node and empty text node
-will be ignored.
-
-
-
-
-
-true if element1 is the previous sibling of element2, false otherwise
-
-an element locator pointing to the first element
-
-an element locator pointing to the second element
-
-Check if these two elements have same parent and are ordered siblings in the DOM. Two same elements will
-not be considered ordered.
-
-
-
-
-
-of pixels from the edge of the frame.
-
-an element locator pointing to an element OR an element itself
-
-Retrieves the horizontal position of an element
-
-
-
-
-
-of pixels from the edge of the frame.
-
-an element locator pointing to an element OR an element itself
-
-Retrieves the vertical position of an element
-
-
-
-
-
-width of an element in pixels
-
-an element locator pointing to an element
-
-Retrieves the width of an element
-
-
-
-
-
-height of an element in pixels
-
-an element locator pointing to an element
-
-Retrieves the height of an element
-
-
-
-
-
-the numerical position of the cursor in the field
-
-an element locator pointing to an input element or textarea
-
-Retrieves the text cursor position in the given input element or textarea; beware, this may not work perfectly on all browsers.
-
-Specifically, if the cursor/selection has been cleared by JavaScript, this command will tend to
-return the position of the last location of the cursor, even though the cursor is now gone from the page. This is filed as SEL-243.
-This method will fail if the specified element isn't an input element or textarea, or there is no cursor in the element.
-
-
-
-
-
-the value passed in
-
-the value to return
-
-Returns the specified expression.
-
-This is useful because of JavaScript preprocessing.
-It is used to generate commands like assertExpression and waitForExpression.
-
-
-
-
-
-the number of nodes that match the specified xpath
-
-the xpath expression to evaluate. do NOT wrap this expression in a 'count()' function; we will do that for you.
-
-Returns the number of nodes that match the specified xpath, eg. "//table" would give
-the number of tables.
-
-
-
-
-
-an element locator pointing to an element
-
-a string to be used as the ID of the specified element
-
-Temporarily sets the "id" attribute of the specified element, so you can locate it in the future
-using its ID rather than a slow/complicated XPath. This ID will disappear once the page is
-reloaded.
-
-
-
-
-
-boolean, true means we'll prefer to use native XPath; false means we'll only use JS XPath
-
-Specifies whether Selenium should use the native in-browser implementation
-of XPath (if any native version is available); if you pass "false" to
-this function, we will always use our pure-JavaScript xpath library.
-Using the pure-JS xpath library can improve the consistency of xpath
-element locators between different browser vendors, but the pure-JS
-version is much slower than the native implementations.
-
-
-
-
-
-boolean, true means we'll ignore attributes without value at the expense of xpath "correctness"; false means we'll sacrifice speed for correctness.
-
-Specifies whether Selenium will ignore xpath attributes that have no
-value, i.e. are the empty string, when using the non-native xpath
-evaluation engine. You'd want to do this for performance reasons in IE.
-However, this could break certain xpaths, for example an xpath that looks
-for an attribute whose value is NOT the empty string.
-
-The hope is that such xpaths are relatively rare, but the user should
-have the option of using them. Note that this only influences xpath
-evaluation when using the ajaxslt engine (i.e. not "javascript-xpath").
-
-
-
-
-
-the JavaScript snippet to run
-
-a timeout in milliseconds, after which this command will return with an error
-
-Runs the specified JavaScript snippet repeatedly until it evaluates to "true".
-The snippet may have multiple lines, but only the result of the last line
-will be considered.
-
-Note that, by default, the snippet will be run in the runner's test window, not in the window
-of your application. To get the window of your application, you can use
-the JavaScript snippet selenium.browserbot.getCurrentWindow(), and then
-run your JavaScript in there
-
-
-
-
-
-a timeout in milliseconds, after which the action will return with an error
-
-Specifies the amount of time that Selenium will wait for actions to complete.
-
-Actions that require waiting include "open" and the "waitFor*" actions.
-The default timeout is 30 seconds.
-
-
-
-
-
-a timeout in milliseconds, after which this command will return with an error
-
-Waits for a new page to load.
-
-You can use this command instead of the "AndWait" suffixes, "clickAndWait", "selectAndWait", "typeAndWait" etc.
-(which are only available in the JS API).
-
-Selenium constantly keeps track of new pages loading, and sets a "newPageLoaded"
-flag when it first notices a page load. Running any other Selenium command after
-turns the flag to false. Hence, if you want to wait for a page to load, you must
-wait immediately after a Selenium command that caused a page-load.
-
-
-
-
-
-FrameAddress from the server side
-
-a timeout in milliseconds, after which this command will return with an error
-
-Waits for a new frame to load.
-
-Selenium constantly keeps track of new pages and frames loading,
-and sets a "newPageLoaded" flag when it first notices a page load.
-
-See waitForPageToLoad for more information.
-
-
-
-
-
-all cookies of the current page under test
-
-Return all cookies of the current page under test.
-
-
-
-
-
-the value of the cookie
-
-the name of the cookie
-
-Returns the value of the cookie with the specified name, or throws an error if the cookie is not present.
-
-
-
-
-
-true if a cookie with the specified name is present, or false otherwise.
-
-the name of the cookie
-
-Returns true if a cookie with the specified name is present, or false otherwise.
-
-
-
-
-
-name and value of the cookie in a format "name=value"
-
-options for the cookie. Currently supported options include 'path', 'max_age' and 'domain'. the optionsString's format is "path=/path/, max_age=60, domain=.foo.com". The order of options are irrelevant, the unit of the value of 'max_age' is second. Note that specifying a domain that isn't a subset of the current domain will usually fail.
-
-Create a new cookie whose path and domain are same with those of current page
-under test, unless you specified a path for this cookie explicitly.
-
-
-
-
-
-the name of the cookie to be deleted
-
-options for the cookie. Currently supported options include 'path', 'domain' and 'recurse.' The optionsString's format is "path=/path/, domain=.foo.com, recurse=true". The order of options are irrelevant. Note that specifying a domain that isn't a subset of the current domain will usually fail.
-
-Delete a named cookie with specified path and domain. Be careful; to delete a cookie, you
-need to delete it using the exact same path and domain that were used to create the cookie.
-If the path is wrong, or the domain is wrong, the cookie simply won't be deleted. Also
-note that specifying a domain that isn't a subset of the current domain will usually fail.
-
-Since there's no way to discover at runtime the original path and domain of a given cookie,
-we've added an option called 'recurse' to try all sub-domains of the current domain with
-all paths that are a subset of the current path. Beware; this option can be slow. In
-big-O notation, it operates in O(n*m) time, where n is the number of dots in the domain
-name and m is the number of slashes in the path.
-
-
-
-
-
-Calls deleteCookie with recurse=true on all cookies visible to the current page.
-As noted on the documentation for deleteCookie, recurse=true can be much slower
-than simply deleting the cookies using a known domain/path.
-
-
-
-
-
-one of the following: "debug", "info", "warn", "error" or "off"
-
-Sets the threshold for browser-side logging messages; log messages beneath this threshold will be discarded.
-Valid logLevel strings are: "debug", "info", "warn", "error" or "off".
-To see the browser logs, you need to
-either show the log window in GUI mode, or enable browser-side logging in Selenium RC.
-
-
-
-
-
-the JavaScript snippet to run
-
-Creates a new "script" tag in the body of the current test window, and
-adds the specified text into the body of the command. Scripts run in
-this way can often be debugged more easily than scripts executed using
-Selenium's "getEval" command. Beware that JS exceptions thrown in these script
-tags aren't managed by Selenium, so you should probably wrap your script
-in try/catch blocks if there is any chance that the script will throw
-an exception.
-
-
-
-
-
-the name of the strategy to define; this should use only letters [a-zA-Z] with no spaces or other punctuation.
-
-a string defining the body of a function in JavaScript. For example: return inDocument.getElementById(locator);
-
-Defines a new function for Selenium to locate elements on the page.
-For example,
-if you define the strategy "foo", and someone runs click("foo=blah"), we'll
-run your function, passing you the string "blah", and click on the element
-that your function
-returns, or throw an "Element not found" error if your function returns null.
-
-We'll pass three arguments to your function:
-
-- locator: the string the user passed in
-- inWindow: the currently selected window
-- inDocument: the currently selected document
-
-The function must return null if the element can't be found.
-
-
-
-
-
-the path to the file to persist the screenshot as. No filename extension will be appended by default. Directories will not be created if they do not exist, and an exception will be thrown, possibly by native code.
-
-a kwargs string that modifies the way the screenshot is captured. Example: "background=#CCFFDD" . Currently valid options: - background
- the background CSS for the HTML document. This may be useful to set for capturing screenshots of less-than-ideal layouts, for example where absolute positioning causes the calculation of the canvas dimension to fail and a black background is exposed (possibly obscuring black text).
-
-Saves the entire contents of the current window canvas to a PNG file.
-Contrast this with the captureScreenshot command, which captures the
-contents of the OS viewport (i.e. whatever is currently being displayed
-on the monitor), and is implemented in the RC only. Currently this only
-works in Firefox when running in chrome mode, and in IE non-HTA using
-the EXPERIMENTAL "Snapsie" utility. The Firefox implementation is mostly
-borrowed from the Screengrab! Firefox extension. Please see
-http://www.screengrab.org and http://snapsie.sourceforge.net/ for
-details.
-
-
-
-
-
-the name of the rollup command
-
-keyword arguments string that influences how the rollup expands into commands
-
-Executes a command rollup, which is a series of commands with a unique
-name, and optionally arguments that control the generation of the set of
-commands. If any one of the rolled-up commands fails, the rollup is
-considered to have failed. Rollups may also contain nested rollups.
-
-
-
-
-
-the Javascript content of the script to add
-
-(optional) the id of the new script tag. If specified, and an element with this id already exists, this operation will fail.
-
-Loads script content into a new script tag in the Selenium document. This
-differs from the runScript command in that runScript adds the script tag
-to the document of the AUT, not the Selenium document. The following
-entities in the script content are replaced by the characters they
-represent:
-
- <
- >
- &
-
-The corresponding remove command is removeScript.
-
-
-
-
-
-the id of the script element to remove.
-
-Removes a script tag from the Selenium document identified by the given
-id. Does nothing if the referenced tag doesn't exist.
-
-
-
-
-
-name of the desired library Only the following three can be chosen: ajaxslt - Google's library javascript - Cybozu Labs' faster library default - The default library. Currently the default library is ajaxslt. If libraryName isn't one of these three, then no change will be made.
-
-Allows choice of one of the available libraries.
-
-
-
-
-
-the message to be sent to the browser
-
-Writes a message to the status bar and adds a note to the browser-side
-log.
-
-
-
-
-
-an element locator
-
-a URL pointing to the specified file. Before the file can be set in the input field (fieldLocator), Selenium RC may need to transfer the file to the local machine before attaching the file in a web page form. This is common in selenium grid configurations where the RC server driving the browser is not the same machine that started the test. Supported Browsers: Firefox ("*chrome") only.
-
-Sets a file input (upload) field to the file listed in fileLocator
-
-
-
-
-
-the absolute path to the file to be written, e.g. "c:\blah\screenshot.png"
-
-Captures a PNG screenshot to the specified file.
-
-
-
-
-
-The base 64 encoded string of the screen shot (PNG file)
-
-Capture a PNG screenshot. It then returns the file as a base 64 encoded string.
-
-
-
-
-
-The base 64 encoded string of the page screenshot (PNG file)
-
-A kwargs string that modifies the way the screenshot is captured. Example: "background=#CCFFDD". This may be useful to set for capturing screenshots of less-than-ideal layouts, for example where absolute positioning causes the calculation of the canvas dimension to fail and a black background is exposed (possibly obscuring black text).
-
-Downloads a screenshot of the browser current window canvas to a
-based 64 encoded PNG file. The entire windows canvas is captured,
-including parts rendered outside of the current view port.
-
-Currently this only works in Mozilla and when running in chrome mode.
-
-
-
-
-
-Kills the running Selenium Server and all browser sessions. After you run this command, you will no longer be able to send
-commands to the server; you can't remotely start the server once it has been stopped. Normally
-you should prefer to run the "stop" command, which terminates the current browser session, rather than
-shutting down the entire server.
-
-
-
-
-
-The last N log messages as a multi-line string.
-
-Retrieve the last messages logged on a specific remote control. Useful for error reports, especially
-when running multiple remote controls in a distributed environment. The maximum number of log messages
-that can be retrieve is configured on remote control startup.
-
-
-
-
-
-an integer keycode number corresponding to a java.awt.event.KeyEvent; note that Java keycodes are NOT the same thing as JavaScript keycodes!
-
-Simulates a user pressing a key (without releasing it yet) by sending a native operating system keystroke.
-This function uses the java.awt.Robot class to send a keystroke; this more accurately simulates typing
-a key on the keyboard. It does not honor settings from the shiftKeyDown, controlKeyDown, altKeyDown and
-metaKeyDown commands, and does not target any particular HTML element. To send a keystroke to a particular
-element, focus on the element first before running this command.
-
-
-
-
-
-an integer keycode number corresponding to a java.awt.event.KeyEvent; note that Java keycodes are NOT the same thing as JavaScript keycodes!
-
-Simulates a user releasing a key by sending a native operating system keystroke.
-This function uses the java.awt.Robot class to send a keystroke; this more accurately simulates typing
-a key on the keyboard. It does not honor settings from the shiftKeyDown, controlKeyDown, altKeyDown and
-metaKeyDown commands, and does not target any particular HTML element. To send a keystroke to a particular
-element, focus on the element first before running this command.
-
-
-
-
-
-an integer keycode number corresponding to a java.awt.event.KeyEvent; note that Java keycodes are NOT the same thing as JavaScript keycodes!
-
-Simulates a user pressing and releasing a key by sending a native operating system keystroke.
-This function uses the java.awt.Robot class to send a keystroke; this more accurately simulates typing
-a key on the keyboard. It does not honor settings from the shiftKeyDown, controlKeyDown, altKeyDown and
-metaKeyDown commands, and does not target any particular HTML element. To send a keystroke to a particular
-element, focus on the element first before running this command.
-
-
-
-
diff --git a/vendor/plugins/selenium-on-rails/selenium-core/lib/cssQuery/cssQuery-p.js b/vendor/plugins/selenium-on-rails/selenium-core/lib/cssQuery/cssQuery-p.js
deleted file mode 100644
index 4a7eb88a..00000000
--- a/vendor/plugins/selenium-on-rails/selenium-core/lib/cssQuery/cssQuery-p.js
+++ /dev/null
@@ -1,6 +0,0 @@
-/*
- cssQuery, version 2.0.2 (2005-08-19)
- Copyright: 2004-2005, Dean Edwards (http://dean.edwards.name/)
- License: http://creativecommons.org/licenses/LGPL/2.1/
-*/
-eval(function(p,a,c,k,e,d){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('7 x=6(){7 1D="2.0.2";7 C=/\\s*,\\s*/;7 x=6(s,A){33{7 m=[];7 u=1z.32.2c&&!A;7 b=(A)?(A.31==22)?A:[A]:[1g];7 1E=18(s).1l(C),i;9(i=0;i<1E.y;i++){s=1y(1E[i]);8(U&&s.Z(0,3).2b("")==" *#"){s=s.Z(2);A=24([],b,s[1])}1A A=b;7 j=0,t,f,a,c="";H(j+~]/;7 20=/[\\s#.:>+~()@]|[^\\s#.:>+~()@]+/g;6 1y(s){8(S.l(s))s=" "+s;5 s.P(20)||[]};7 W=/\\s*([\\s>+~(),]|^|$)\\s*/g;7 I=/([\\s>+~,]|[^(]\\+|^)([#.:@])/g;7 18=6(s){5 s.O(W,"$1").O(I,"$1*$2")};7 1u={1Z:6(){5"\'"},P:/^(\'[^\']*\')|("[^"]*")$/,l:6(s){5 o.P.l(s)},1S:6(s){5 o.l(s)?s:o+s+o},1Y:6(s){5 o.l(s)?s.Z(1,-1):s}};7 1s=6(t){5 1u.1Y(t)};7 E=/([\\/()[\\]?{}|*+-])/g;6 R(s){5 s.O(E,"\\\\$1")};x.15("1j-2H",6(){D[">"]=6(r,f,t,n){7 e,i,j;9(i=0;i=c);5(c%m)==s}});x.15("1j-2m",6(){U=1i("L;/*@2l@8(@\\2k)U=K@2j@*/");8(!U){X=6(e,t,n){5 n?e.2i("*",t):e.X(t)};14=6(e,n){5!n||(n=="*")||(e.2h==n)};1h=1g.1I?6(e){5/1J/i.l(Q(e).1I)}:6(e){5 Q(e).1H.1f!="2g"};1e=6(e){5 e.2f||e.1G||1b(e)};6 1b(e){7 t="",n,i;9(i=0;(n=e.1F[i]);i++){1d(n.1c){F 11:F 1:t+=1b(n);1a;F 3:t+=n.2e;1a}}5 t}}});19=K;5 x}();',62,190,'|||||return|function|var|if|for||||||||pseudoClasses||||test|||this||AttributeSelector|||||||cssQuery|length|push|fr|id||selectors||case|nextElementSibling|while||tests|true|false|thisElement||replace|match|getDocument|regEscape||attributeSelectors|isMSIE|cache||getElementsByTagName|isNaN|slice|child||new|getAttribute|compareNamespace|addModule|previousElementSibling|compareTagName|parseSelector|loaded|break|_0|nodeType|switch|getTextContent|tagName|document|isXML|eval|css|_1|split|ch|parentNode|childElements|nthChild|disabled|firstElementChild|getText|RegExp|Quote|x22|PREFIX|lang|_2|arguments|else|all|links|version|se|childNodes|innerText|documentElement|contentType|xml|parseInt|indeterminate|checked|last|nth|lastElementChild|parse|_3|add|href|String|className|create|NS_IE|remove|toString|ST|select|Array|null|_4|mimeType|lastChild|firstChild|continue|modules|delete|join|caching|error|nodeValue|textContent|HTML|prefix|getElementsByTagNameNS|end|x5fwin32|cc_on|standard||odd|even|enabled|hash|location|target|not|only|empty|root|contains|level3|outerHTML|htmlFor|class|toLowerCase|Function|name|first|level2|prototype|item|scopeName|toUpperCase|ownerDocument|Document|XML|Boolean|URL|unknown|typeof|nextSibling|previousSibling|visited|link|valueOf|clearCache|catch|concat|constructor|callee|try'.split('|'),0,{}))
diff --git a/vendor/plugins/selenium-on-rails/selenium-core/lib/cssQuery/src/cssQuery-level2.js b/vendor/plugins/selenium-on-rails/selenium-core/lib/cssQuery/src/cssQuery-level2.js
deleted file mode 100644
index 02dd0e5f..00000000
--- a/vendor/plugins/selenium-on-rails/selenium-core/lib/cssQuery/src/cssQuery-level2.js
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- cssQuery, version 2.0.2 (2005-08-19)
- Copyright: 2004-2005, Dean Edwards (http://dean.edwards.name/)
- License: http://creativecommons.org/licenses/LGPL/2.1/
-*/
-
-cssQuery.addModule("css-level2", function() {
-
-// -----------------------------------------------------------------------
-// selectors
-// -----------------------------------------------------------------------
-
-// child selector
-selectors[">"] = function($results, $from, $tagName, $namespace) {
- var $element, i, j;
- for (i = 0; i < $from.length; i++) {
- var $subset = childElements($from[i]);
- for (j = 0; ($element = $subset[j]); j++)
- if (compareTagName($element, $tagName, $namespace))
- $results.push($element);
- }
-};
-
-// sibling selector
-selectors["+"] = function($results, $from, $tagName, $namespace) {
- for (var i = 0; i < $from.length; i++) {
- var $element = nextElementSibling($from[i]);
- if ($element && compareTagName($element, $tagName, $namespace))
- $results.push($element);
- }
-};
-
-// attribute selector
-selectors["@"] = function($results, $from, $attributeSelectorID) {
- var $test = attributeSelectors[$attributeSelectorID].test;
- var $element, i;
- for (i = 0; ($element = $from[i]); i++)
- if ($test($element)) $results.push($element);
-};
-
-// -----------------------------------------------------------------------
-// pseudo-classes
-// -----------------------------------------------------------------------
-
-pseudoClasses["first-child"] = function($element) {
- return !previousElementSibling($element);
-};
-
-pseudoClasses["lang"] = function($element, $code) {
- $code = new RegExp("^" + $code, "i");
- while ($element && !$element.getAttribute("lang")) $element = $element.parentNode;
- return $element && $code.test($element.getAttribute("lang"));
-};
-
-// -----------------------------------------------------------------------
-// attribute selectors
-// -----------------------------------------------------------------------
-
-// constants
-AttributeSelector.NS_IE = /\\:/g;
-AttributeSelector.PREFIX = "@";
-// properties
-AttributeSelector.tests = {};
-// methods
-AttributeSelector.replace = function($match, $attribute, $namespace, $compare, $value) {
- var $key = this.PREFIX + $match;
- if (!attributeSelectors[$key]) {
- $attribute = this.create($attribute, $compare || "", $value || "");
- // store the selector
- attributeSelectors[$key] = $attribute;
- attributeSelectors.push($attribute);
- }
- return attributeSelectors[$key].id;
-};
-AttributeSelector.parse = function($selector) {
- $selector = $selector.replace(this.NS_IE, "|");
- var $match;
- while ($match = $selector.match(this.match)) {
- var $replace = this.replace($match[0], $match[1], $match[2], $match[3], $match[4]);
- $selector = $selector.replace(this.match, $replace);
- }
- return $selector;
-};
-AttributeSelector.create = function($propertyName, $test, $value) {
- var $attributeSelector = {};
- $attributeSelector.id = this.PREFIX + attributeSelectors.length;
- $attributeSelector.name = $propertyName;
- $test = this.tests[$test];
- $test = $test ? $test(this.getAttribute($propertyName), getText($value)) : false;
- $attributeSelector.test = new Function("e", "return " + $test);
- return $attributeSelector;
-};
-AttributeSelector.getAttribute = function($name) {
- switch ($name.toLowerCase()) {
- case "id":
- return "e.id";
- case "class":
- return "e.className";
- case "for":
- return "e.htmlFor";
- case "href":
- if (isMSIE) {
- // IE always returns the full path not the fragment in the href attribute
- // so we RegExp it out of outerHTML. Opera does the same thing but there
- // is no way to get the original attribute.
- return "String((e.outerHTML.match(/href=\\x22?([^\\s\\x22]*)\\x22?/)||[])[1]||'')";
- }
- }
- return "e.getAttribute('" + $name.replace($NAMESPACE, ":") + "')";
-};
-
-// -----------------------------------------------------------------------
-// attribute selector tests
-// -----------------------------------------------------------------------
-
-AttributeSelector.tests[""] = function($attribute) {
- return $attribute;
-};
-
-AttributeSelector.tests["="] = function($attribute, $value) {
- return $attribute + "==" + Quote.add($value);
-};
-
-AttributeSelector.tests["~="] = function($attribute, $value) {
- return "/(^| )" + regEscape($value) + "( |$)/.test(" + $attribute + ")";
-};
-
-AttributeSelector.tests["|="] = function($attribute, $value) {
- return "/^" + regEscape($value) + "(-|$)/.test(" + $attribute + ")";
-};
-
-// -----------------------------------------------------------------------
-// parsing
-// -----------------------------------------------------------------------
-
-// override parseSelector to parse out attribute selectors
-var _parseSelector = parseSelector;
-parseSelector = function($selector) {
- return _parseSelector(AttributeSelector.parse($selector));
-};
-
-}); // addModule
diff --git a/vendor/plugins/selenium-on-rails/selenium-core/lib/cssQuery/src/cssQuery-level3.js b/vendor/plugins/selenium-on-rails/selenium-core/lib/cssQuery/src/cssQuery-level3.js
deleted file mode 100644
index 11d19664..00000000
--- a/vendor/plugins/selenium-on-rails/selenium-core/lib/cssQuery/src/cssQuery-level3.js
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- cssQuery, version 2.0.2 (2005-08-19)
- Copyright: 2004-2005, Dean Edwards (http://dean.edwards.name/)
- License: http://creativecommons.org/licenses/LGPL/2.1/
-*/
-
-/* Thanks to Bill Edney */
-
-cssQuery.addModule("css-level3", function() {
-
-// -----------------------------------------------------------------------
-// selectors
-// -----------------------------------------------------------------------
-
-// indirect sibling selector
-selectors["~"] = function($results, $from, $tagName, $namespace) {
- var $element, i;
- for (i = 0; ($element = $from[i]); i++) {
- while ($element = nextElementSibling($element)) {
- if (compareTagName($element, $tagName, $namespace))
- $results.push($element);
- }
- }
-};
-
-// -----------------------------------------------------------------------
-// pseudo-classes
-// -----------------------------------------------------------------------
-
-// I'm hoping these pseudo-classes are pretty readable. Let me know if
-// any need explanation.
-
-pseudoClasses["contains"] = function($element, $text) {
- $text = new RegExp(regEscape(getText($text)));
- return $text.test(getTextContent($element));
-};
-
-pseudoClasses["root"] = function($element) {
- return $element == getDocument($element).documentElement;
-};
-
-pseudoClasses["empty"] = function($element) {
- var $node, i;
- for (i = 0; ($node = $element.childNodes[i]); i++) {
- if (thisElement($node) || $node.nodeType == 3) return false;
- }
- return true;
-};
-
-pseudoClasses["last-child"] = function($element) {
- return !nextElementSibling($element);
-};
-
-pseudoClasses["only-child"] = function($element) {
- $element = $element.parentNode;
- return firstElementChild($element) == lastElementChild($element);
-};
-
-pseudoClasses["not"] = function($element, $selector) {
- var $negated = cssQuery($selector, getDocument($element));
- for (var i = 0; i < $negated.length; i++) {
- if ($negated[i] == $element) return false;
- }
- return true;
-};
-
-pseudoClasses["nth-child"] = function($element, $arguments) {
- return nthChild($element, $arguments, previousElementSibling);
-};
-
-pseudoClasses["nth-last-child"] = function($element, $arguments) {
- return nthChild($element, $arguments, nextElementSibling);
-};
-
-pseudoClasses["target"] = function($element) {
- return $element.id == location.hash.slice(1);
-};
-
-// UI element states
-
-pseudoClasses["checked"] = function($element) {
- return $element.checked;
-};
-
-pseudoClasses["enabled"] = function($element) {
- return $element.disabled === false;
-};
-
-pseudoClasses["disabled"] = function($element) {
- return $element.disabled;
-};
-
-pseudoClasses["indeterminate"] = function($element) {
- return $element.indeterminate;
-};
-
-// -----------------------------------------------------------------------
-// attribute selector tests
-// -----------------------------------------------------------------------
-
-AttributeSelector.tests["^="] = function($attribute, $value) {
- return "/^" + regEscape($value) + "/.test(" + $attribute + ")";
-};
-
-AttributeSelector.tests["$="] = function($attribute, $value) {
- return "/" + regEscape($value) + "$/.test(" + $attribute + ")";
-};
-
-AttributeSelector.tests["*="] = function($attribute, $value) {
- return "/" + regEscape($value) + "/.test(" + $attribute + ")";
-};
-
-// -----------------------------------------------------------------------
-// nth child support (Bill Edney)
-// -----------------------------------------------------------------------
-
-function nthChild($element, $arguments, $traverse) {
- switch ($arguments) {
- case "n": return true;
- case "even": $arguments = "2n"; break;
- case "odd": $arguments = "2n+1";
- }
-
- var $$children = childElements($element.parentNode);
- function _checkIndex($index) {
- var $index = ($traverse == nextElementSibling) ? $$children.length - $index : $index - 1;
- return $$children[$index] == $element;
- };
-
- // it was just a number (no "n")
- if (!isNaN($arguments)) return _checkIndex($arguments);
-
- $arguments = $arguments.split("n");
- var $multiplier = parseInt($arguments[0]);
- var $step = parseInt($arguments[1]);
-
- if ((isNaN($multiplier) || $multiplier == 1) && $step == 0) return true;
- if ($multiplier == 0 && !isNaN($step)) return _checkIndex($step);
- if (isNaN($step)) $step = 0;
-
- var $count = 1;
- while ($element = $traverse($element)) $count++;
-
- if (isNaN($multiplier) || $multiplier == 1)
- return ($traverse == nextElementSibling) ? ($count <= $step) : ($step >= $count);
-
- return ($count % $multiplier) == $step;
-};
-
-}); // addModule
diff --git a/vendor/plugins/selenium-on-rails/selenium-core/lib/cssQuery/src/cssQuery-standard.js b/vendor/plugins/selenium-on-rails/selenium-core/lib/cssQuery/src/cssQuery-standard.js
deleted file mode 100644
index 77314b86..00000000
--- a/vendor/plugins/selenium-on-rails/selenium-core/lib/cssQuery/src/cssQuery-standard.js
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- cssQuery, version 2.0.2 (2005-08-19)
- Copyright: 2004-2005, Dean Edwards (http://dean.edwards.name/)
- License: http://creativecommons.org/licenses/LGPL/2.1/
-*/
-
-cssQuery.addModule("css-standard", function() { // override IE optimisation
-
-// cssQuery was originally written as the CSS engine for IE7. It is
-// optimised (in terms of size not speed) for IE so this module is
-// provided separately to provide cross-browser support.
-
-// -----------------------------------------------------------------------
-// browser compatibility
-// -----------------------------------------------------------------------
-
-// sniff for Win32 Explorer
-isMSIE = eval("false;/*@cc_on@if(@\x5fwin32)isMSIE=true@end@*/");
-
-if (!isMSIE) {
- getElementsByTagName = function($element, $tagName, $namespace) {
- return $namespace ? $element.getElementsByTagNameNS("*", $tagName) :
- $element.getElementsByTagName($tagName);
- };
-
- compareNamespace = function($element, $namespace) {
- return !$namespace || ($namespace == "*") || ($element.prefix == $namespace);
- };
-
- isXML = document.contentType ? function($element) {
- return /xml/i.test(getDocument($element).contentType);
- } : function($element) {
- return getDocument($element).documentElement.tagName != "HTML";
- };
-
- getTextContent = function($element) {
- // mozilla || opera || other
- return $element.textContent || $element.innerText || _getTextContent($element);
- };
-
- function _getTextContent($element) {
- var $textContent = "", $node, i;
- for (i = 0; ($node = $element.childNodes[i]); i++) {
- switch ($node.nodeType) {
- case 11: // document fragment
- case 1: $textContent += _getTextContent($node); break;
- case 3: $textContent += $node.nodeValue; break;
- }
- }
- return $textContent;
- };
-}
-}); // addModule
diff --git a/vendor/plugins/selenium-on-rails/selenium-core/lib/cssQuery/src/cssQuery.js b/vendor/plugins/selenium-on-rails/selenium-core/lib/cssQuery/src/cssQuery.js
deleted file mode 100644
index 1fcab4a1..00000000
--- a/vendor/plugins/selenium-on-rails/selenium-core/lib/cssQuery/src/cssQuery.js
+++ /dev/null
@@ -1,356 +0,0 @@
-/*
- cssQuery, version 2.0.2 (2005-08-19)
- Copyright: 2004-2005, Dean Edwards (http://dean.edwards.name/)
- License: http://creativecommons.org/licenses/LGPL/2.1/
-*/
-
-// the following functions allow querying of the DOM using CSS selectors
-var cssQuery = function() {
-var version = "2.0.2";
-
-// -----------------------------------------------------------------------
-// main query function
-// -----------------------------------------------------------------------
-
-var $COMMA = /\s*,\s*/;
-var cssQuery = function($selector, $$from) {
-try {
- var $match = [];
- var $useCache = arguments.callee.caching && !$$from;
- var $base = ($$from) ? ($$from.constructor == Array) ? $$from : [$$from] : [document];
- // process comma separated selectors
- var $$selectors = parseSelector($selector).split($COMMA), i;
- for (i = 0; i < $$selectors.length; i++) {
- // convert the selector to a stream
- $selector = _toStream($$selectors[i]);
- // faster chop if it starts with id (MSIE only)
- if (isMSIE && $selector.slice(0, 3).join("") == " *#") {
- $selector = $selector.slice(2);
- $$from = _msie_selectById([], $base, $selector[1]);
- } else $$from = $base;
- // process the stream
- var j = 0, $token, $filter, $arguments, $cacheSelector = "";
- while (j < $selector.length) {
- $token = $selector[j++];
- $filter = $selector[j++];
- $cacheSelector += $token + $filter;
- // some pseudo-classes allow arguments to be passed
- // e.g. nth-child(even)
- $arguments = "";
- if ($selector[j] == "(") {
- while ($selector[j++] != ")" && j < $selector.length) {
- $arguments += $selector[j];
- }
- $arguments = $arguments.slice(0, -1);
- $cacheSelector += "(" + $arguments + ")";
- }
- // process a token/filter pair use cached results if possible
- $$from = ($useCache && cache[$cacheSelector]) ?
- cache[$cacheSelector] : select($$from, $token, $filter, $arguments);
- if ($useCache) cache[$cacheSelector] = $$from;
- }
- $match = $match.concat($$from);
- }
- delete cssQuery.error;
- return $match;
-} catch ($error) {
- cssQuery.error = $error;
- return [];
-}};
-
-// -----------------------------------------------------------------------
-// public interface
-// -----------------------------------------------------------------------
-
-cssQuery.toString = function() {
- return "function cssQuery() {\n [version " + version + "]\n}";
-};
-
-// caching
-var cache = {};
-cssQuery.caching = false;
-cssQuery.clearCache = function($selector) {
- if ($selector) {
- $selector = _toStream($selector).join("");
- delete cache[$selector];
- } else cache = {};
-};
-
-// allow extensions
-var modules = {};
-var loaded = false;
-cssQuery.addModule = function($name, $script) {
- if (loaded) eval("$script=" + String($script));
- modules[$name] = new $script();;
-};
-
-// hackery
-cssQuery.valueOf = function($code) {
- return $code ? eval($code) : this;
-};
-
-// -----------------------------------------------------------------------
-// declarations
-// -----------------------------------------------------------------------
-
-var selectors = {};
-var pseudoClasses = {};
-// a safari bug means that these have to be declared here
-var AttributeSelector = {match: /\[([\w-]+(\|[\w-]+)?)\s*(\W?=)?\s*([^\]]*)\]/};
-var attributeSelectors = [];
-
-// -----------------------------------------------------------------------
-// selectors
-// -----------------------------------------------------------------------
-
-// descendant selector
-selectors[" "] = function($results, $from, $tagName, $namespace) {
- // loop through current selection
- var $element, i, j;
- for (i = 0; i < $from.length; i++) {
- // get descendants
- var $subset = getElementsByTagName($from[i], $tagName, $namespace);
- // loop through descendants and add to results selection
- for (j = 0; ($element = $subset[j]); j++) {
- if (thisElement($element) && compareNamespace($element, $namespace))
- $results.push($element);
- }
- }
-};
-
-// ID selector
-selectors["#"] = function($results, $from, $id) {
- // loop through current selection and check ID
- var $element, j;
- for (j = 0; ($element = $from[j]); j++) if ($element.id == $id) $results.push($element);
-};
-
-// class selector
-selectors["."] = function($results, $from, $className) {
- // create a RegExp version of the class
- $className = new RegExp("(^|\\s)" + $className + "(\\s|$)");
- // loop through current selection and check class
- var $element, i;
- for (i = 0; ($element = $from[i]); i++)
- if ($className.test($element.className)) $results.push($element);
-};
-
-// pseudo-class selector
-selectors[":"] = function($results, $from, $pseudoClass, $arguments) {
- // retrieve the cssQuery pseudo-class function
- var $test = pseudoClasses[$pseudoClass], $element, i;
- // loop through current selection and apply pseudo-class filter
- if ($test) for (i = 0; ($element = $from[i]); i++)
- // if the cssQuery pseudo-class function returns "true" add the element
- if ($test($element, $arguments)) $results.push($element);
-};
-
-// -----------------------------------------------------------------------
-// pseudo-classes
-// -----------------------------------------------------------------------
-
-pseudoClasses["link"] = function($element) {
- var $document = getDocument($element);
- if ($document.links) for (var i = 0; i < $document.links.length; i++) {
- if ($document.links[i] == $element) return true;
- }
-};
-
-pseudoClasses["visited"] = function($element) {
- // can't do this without jiggery-pokery
-};
-
-// -----------------------------------------------------------------------
-// DOM traversal
-// -----------------------------------------------------------------------
-
-// IE5/6 includes comments (LOL) in it's elements collections.
-// so we have to check for this. the test is tagName != "!". LOL (again).
-var thisElement = function($element) {
- return ($element && $element.nodeType == 1 && $element.tagName != "!") ? $element : null;
-};
-
-// return the previous element to the supplied element
-// previousSibling is not good enough as it might return a text or comment node
-var previousElementSibling = function($element) {
- while ($element && ($element = $element.previousSibling) && !thisElement($element)) continue;
- return $element;
-};
-
-// return the next element to the supplied element
-var nextElementSibling = function($element) {
- while ($element && ($element = $element.nextSibling) && !thisElement($element)) continue;
- return $element;
-};
-
-// return the first child ELEMENT of an element
-// NOT the first child node (though they may be the same thing)
-var firstElementChild = function($element) {
- return thisElement($element.firstChild) || nextElementSibling($element.firstChild);
-};
-
-var lastElementChild = function($element) {
- return thisElement($element.lastChild) || previousElementSibling($element.lastChild);
-};
-
-// return child elements of an element (not child nodes)
-var childElements = function($element) {
- var $childElements = [];
- $element = firstElementChild($element);
- while ($element) {
- $childElements.push($element);
- $element = nextElementSibling($element);
- }
- return $childElements;
-};
-
-// -----------------------------------------------------------------------
-// browser compatibility
-// -----------------------------------------------------------------------
-
-// all of the functions in this section can be overwritten. the default
-// configuration is for IE. The functions below reflect this. standard
-// methods are included in a separate module. It would probably be better
-// the other way round of course but this makes it easier to keep IE7 trim.
-
-var isMSIE = true;
-
-var isXML = function($element) {
- var $document = getDocument($element);
- return (typeof $document.mimeType == "unknown") ?
- /\.xml$/i.test($document.URL) :
- Boolean($document.mimeType == "XML Document");
-};
-
-// return the element's containing document
-var getDocument = function($element) {
- return $element.ownerDocument || $element.document;
-};
-
-var getElementsByTagName = function($element, $tagName) {
- return ($tagName == "*" && $element.all) ? $element.all : $element.getElementsByTagName($tagName);
-};
-
-var compareTagName = function($element, $tagName, $namespace) {
- if ($tagName == "*") return thisElement($element);
- if (!compareNamespace($element, $namespace)) return false;
- if (!isXML($element)) $tagName = $tagName.toUpperCase();
- return $element.tagName == $tagName;
-};
-
-var compareNamespace = function($element, $namespace) {
- return !$namespace || ($namespace == "*") || ($element.scopeName == $namespace);
-};
-
-var getTextContent = function($element) {
- return $element.innerText;
-};
-
-function _msie_selectById($results, $from, id) {
- var $match, i, j;
- for (i = 0; i < $from.length; i++) {
- if ($match = $from[i].all.item(id)) {
- if ($match.id == id) $results.push($match);
- else if ($match.length != null) {
- for (j = 0; j < $match.length; j++) {
- if ($match[j].id == id) $results.push($match[j]);
- }
- }
- }
- }
- return $results;
-};
-
-// for IE5.0
-if (![].push) Array.prototype.push = function() {
- for (var i = 0; i < arguments.length; i++) {
- this[this.length] = arguments[i];
- }
- return this.length;
-};
-
-// -----------------------------------------------------------------------
-// query support
-// -----------------------------------------------------------------------
-
-// select a set of matching elements.
-// "from" is an array of elements.
-// "token" is a character representing the type of filter
-// e.g. ">" means child selector
-// "filter" represents the tag name, id or class name that is being selected
-// the function returns an array of matching elements
-var $NAMESPACE = /\|/;
-function select($$from, $token, $filter, $arguments) {
- if ($NAMESPACE.test($filter)) {
- $filter = $filter.split($NAMESPACE);
- $arguments = $filter[0];
- $filter = $filter[1];
- }
- var $results = [];
- if (selectors[$token]) {
- selectors[$token]($results, $$from, $filter, $arguments);
- }
- return $results;
-};
-
-// -----------------------------------------------------------------------
-// parsing
-// -----------------------------------------------------------------------
-
-// convert css selectors to a stream of tokens and filters
-// it's not a real stream. it's just an array of strings.
-var $STANDARD_SELECT = /^[^\s>+~]/;
-var $$STREAM = /[\s#.:>+~()@]|[^\s#.:>+~()@]+/g;
-function _toStream($selector) {
- if ($STANDARD_SELECT.test($selector)) $selector = " " + $selector;
- return $selector.match($$STREAM) || [];
-};
-
-var $WHITESPACE = /\s*([\s>+~(),]|^|$)\s*/g;
-var $IMPLIED_ALL = /([\s>+~,]|[^(]\+|^)([#.:@])/g;
-var parseSelector = function($selector) {
- return $selector
- // trim whitespace
- .replace($WHITESPACE, "$1")
- // e.g. ".class1" --> "*.class1"
- .replace($IMPLIED_ALL, "$1*$2");
-};
-
-var Quote = {
- toString: function() {return "'"},
- match: /^('[^']*')|("[^"]*")$/,
- test: function($string) {
- return this.match.test($string);
- },
- add: function($string) {
- return this.test($string) ? $string : this + $string + this;
- },
- remove: function($string) {
- return this.test($string) ? $string.slice(1, -1) : $string;
- }
-};
-
-var getText = function($text) {
- return Quote.remove($text);
-};
-
-var $ESCAPE = /([\/()[\]?{}|*+-])/g;
-function regEscape($string) {
- return $string.replace($ESCAPE, "\\$1");
-};
-
-// -----------------------------------------------------------------------
-// modules
-// -----------------------------------------------------------------------
-
-// -------- >> insert modules here for packaging << -------- \\
-
-loaded = true;
-
-// -----------------------------------------------------------------------
-// return the query function
-// -----------------------------------------------------------------------
-
-return cssQuery;
-
-}(); // cssQuery
diff --git a/vendor/plugins/selenium-on-rails/selenium-core/lib/prototype.js b/vendor/plugins/selenium-on-rails/selenium-core/lib/prototype.js
deleted file mode 100644
index 4453c4f5..00000000
--- a/vendor/plugins/selenium-on-rails/selenium-core/lib/prototype.js
+++ /dev/null
@@ -1,2006 +0,0 @@
-/* Prototype JavaScript framework, version 1.5.0_rc0
- * (c) 2005 Sam Stephenson
- *
- * Prototype is freely distributable under the terms of an MIT-style license.
- * For details, see the Prototype web site: http://prototype.conio.net/
- *
-/*--------------------------------------------------------------------------*/
-
-var Prototype = {
- Version: '1.5.0_rc0',
- ScriptFragment: '(?:)((\n|\r|.)*?)(?:<\/script>)',
-
- emptyFunction: function() {},
- K: function(x) {return x}
-}
-
-var Class = {
- create: function() {
- return function() {
- this.initialize.apply(this, arguments);
- }
- }
-}
-
-var Abstract = new Object();
-
-Object.extend = function(destination, source) {
- for (var property in source) {
- destination[property] = source[property];
- }
- return destination;
-}
-
-Object.inspect = function(object) {
- try {
- if (object == undefined) return 'undefined';
- if (object == null) return 'null';
- return object.inspect ? object.inspect() : object.toString();
- } catch (e) {
- if (e instanceof RangeError) return '...';
- throw e;
- }
-}
-
-Function.prototype.bind = function() {
- var __method = this, args = $A(arguments), object = args.shift();
- return function() {
- return __method.apply(object, args.concat($A(arguments)));
- }
-}
-
-Function.prototype.bindAsEventListener = function(object) {
- var __method = this;
- return function(event) {
- return __method.call(object, event || window.event);
- }
-}
-
-Object.extend(Number.prototype, {
- toColorPart: function() {
- var digits = this.toString(16);
- if (this < 16) return '0' + digits;
- return digits;
- },
-
- succ: function() {
- return this + 1;
- },
-
- times: function(iterator) {
- $R(0, this, true).each(iterator);
- return this;
- }
-});
-
-var Try = {
- these: function() {
- var returnValue;
-
- for (var i = 0; i < arguments.length; i++) {
- var lambda = arguments[i];
- try {
- returnValue = lambda();
- break;
- } catch (e) {}
- }
-
- return returnValue;
- }
-}
-
-/*--------------------------------------------------------------------------*/
-
-var PeriodicalExecuter = Class.create();
-PeriodicalExecuter.prototype = {
- initialize: function(callback, frequency) {
- this.callback = callback;
- this.frequency = frequency;
- this.currentlyExecuting = false;
-
- this.registerCallback();
- },
-
- registerCallback: function() {
- setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
- },
-
- onTimerEvent: function() {
- if (!this.currentlyExecuting) {
- try {
- this.currentlyExecuting = true;
- this.callback();
- } finally {
- this.currentlyExecuting = false;
- }
- }
- }
-}
-Object.extend(String.prototype, {
- gsub: function(pattern, replacement) {
- var result = '', source = this, match;
- replacement = arguments.callee.prepareReplacement(replacement);
-
- while (source.length > 0) {
- if (match = source.match(pattern)) {
- result += source.slice(0, match.index);
- result += (replacement(match) || '').toString();
- source = source.slice(match.index + match[0].length);
- } else {
- result += source, source = '';
- }
- }
- return result;
- },
-
- sub: function(pattern, replacement, count) {
- replacement = this.gsub.prepareReplacement(replacement);
- count = count === undefined ? 1 : count;
-
- return this.gsub(pattern, function(match) {
- if (--count < 0) return match[0];
- return replacement(match);
- });
- },
-
- scan: function(pattern, iterator) {
- this.gsub(pattern, iterator);
- return this;
- },
-
- truncate: function(length, truncation) {
- length = length || 30;
- truncation = truncation === undefined ? '...' : truncation;
- return this.length > length ?
- this.slice(0, length - truncation.length) + truncation : this;
- },
-
- strip: function() {
- return this.replace(/^\s+/, '').replace(/\s+$/, '');
- },
-
- stripTags: function() {
- return this.replace(/<\/?[^>]+>/gi, '');
- },
-
- stripScripts: function() {
- return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), '');
- },
-
- extractScripts: function() {
- var matchAll = new RegExp(Prototype.ScriptFragment, 'img');
- var matchOne = new RegExp(Prototype.ScriptFragment, 'im');
- return (this.match(matchAll) || []).map(function(scriptTag) {
- return (scriptTag.match(matchOne) || ['', ''])[1];
- });
- },
-
- evalScripts: function() {
- return this.extractScripts().map(function(script) { return eval(script) });
- },
-
- escapeHTML: function() {
- var div = document.createElement('div');
- var text = document.createTextNode(this);
- div.appendChild(text);
- return div.innerHTML;
- },
-
- unescapeHTML: function() {
- var div = document.createElement('div');
- div.innerHTML = this.stripTags();
- return div.childNodes[0] ? div.childNodes[0].nodeValue : '';
- },
-
- toQueryParams: function() {
- var pairs = this.match(/^\??(.*)$/)[1].split('&');
- return pairs.inject({}, function(params, pairString) {
- var pair = pairString.split('=');
- params[pair[0]] = pair[1];
- return params;
- });
- },
-
- toArray: function() {
- return this.split('');
- },
-
- camelize: function() {
- var oStringList = this.split('-');
- if (oStringList.length == 1) return oStringList[0];
-
- var camelizedString = this.indexOf('-') == 0
- ? oStringList[0].charAt(0).toUpperCase() + oStringList[0].substring(1)
- : oStringList[0];
-
- for (var i = 1, len = oStringList.length; i < len; i++) {
- var s = oStringList[i];
- camelizedString += s.charAt(0).toUpperCase() + s.substring(1);
- }
-
- return camelizedString;
- },
-
- inspect: function() {
- return "'" + this.replace(/\\/g, '\\\\').replace(/'/g, '\\\'') + "'";
- }
-});
-
-String.prototype.gsub.prepareReplacement = function(replacement) {
- if (typeof replacement == 'function') return replacement;
- var template = new Template(replacement);
- return function(match) { return template.evaluate(match) };
-}
-
-String.prototype.parseQuery = String.prototype.toQueryParams;
-
-var Template = Class.create();
-Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/;
-Template.prototype = {
- initialize: function(template, pattern) {
- this.template = template.toString();
- this.pattern = pattern || Template.Pattern;
- },
-
- evaluate: function(object) {
- return this.template.gsub(this.pattern, function(match) {
- var before = match[1];
- if (before == '\\') return match[2];
- return before + (object[match[3]] || '').toString();
- });
- }
-}
-
-var $break = new Object();
-var $continue = new Object();
-
-var Enumerable = {
- each: function(iterator) {
- var index = 0;
- try {
- this._each(function(value) {
- try {
- iterator(value, index++);
- } catch (e) {
- if (e != $continue) throw e;
- }
- });
- } catch (e) {
- if (e != $break) throw e;
- }
- },
-
- all: function(iterator) {
- var result = true;
- this.each(function(value, index) {
- result = result && !!(iterator || Prototype.K)(value, index);
- if (!result) throw $break;
- });
- return result;
- },
-
- any: function(iterator) {
- var result = true;
- this.each(function(value, index) {
- if (result = !!(iterator || Prototype.K)(value, index))
- throw $break;
- });
- return result;
- },
-
- collect: function(iterator) {
- var results = [];
- this.each(function(value, index) {
- results.push(iterator(value, index));
- });
- return results;
- },
-
- detect: function (iterator) {
- var result;
- this.each(function(value, index) {
- if (iterator(value, index)) {
- result = value;
- throw $break;
- }
- });
- return result;
- },
-
- findAll: function(iterator) {
- var results = [];
- this.each(function(value, index) {
- if (iterator(value, index))
- results.push(value);
- });
- return results;
- },
-
- grep: function(pattern, iterator) {
- var results = [];
- this.each(function(value, index) {
- var stringValue = value.toString();
- if (stringValue.match(pattern))
- results.push((iterator || Prototype.K)(value, index));
- })
- return results;
- },
-
- include: function(object) {
- var found = false;
- this.each(function(value) {
- if (value == object) {
- found = true;
- throw $break;
- }
- });
- return found;
- },
-
- inject: function(memo, iterator) {
- this.each(function(value, index) {
- memo = iterator(memo, value, index);
- });
- return memo;
- },
-
- invoke: function(method) {
- var args = $A(arguments).slice(1);
- return this.collect(function(value) {
- return value[method].apply(value, args);
- });
- },
-
- max: function(iterator) {
- var result;
- this.each(function(value, index) {
- value = (iterator || Prototype.K)(value, index);
- if (result == undefined || value >= result)
- result = value;
- });
- return result;
- },
-
- min: function(iterator) {
- var result;
- this.each(function(value, index) {
- value = (iterator || Prototype.K)(value, index);
- if (result == undefined || value < result)
- result = value;
- });
- return result;
- },
-
- partition: function(iterator) {
- var trues = [], falses = [];
- this.each(function(value, index) {
- ((iterator || Prototype.K)(value, index) ?
- trues : falses).push(value);
- });
- return [trues, falses];
- },
-
- pluck: function(property) {
- var results = [];
- this.each(function(value, index) {
- results.push(value[property]);
- });
- return results;
- },
-
- reject: function(iterator) {
- var results = [];
- this.each(function(value, index) {
- if (!iterator(value, index))
- results.push(value);
- });
- return results;
- },
-
- sortBy: function(iterator) {
- return this.collect(function(value, index) {
- return {value: value, criteria: iterator(value, index)};
- }).sort(function(left, right) {
- var a = left.criteria, b = right.criteria;
- return a < b ? -1 : a > b ? 1 : 0;
- }).pluck('value');
- },
-
- toArray: function() {
- return this.collect(Prototype.K);
- },
-
- zip: function() {
- var iterator = Prototype.K, args = $A(arguments);
- if (typeof args.last() == 'function')
- iterator = args.pop();
-
- var collections = [this].concat(args).map($A);
- return this.map(function(value, index) {
- return iterator(collections.pluck(index));
- });
- },
-
- inspect: function() {
- return '#';
- }
-}
-
-Object.extend(Enumerable, {
- map: Enumerable.collect,
- find: Enumerable.detect,
- select: Enumerable.findAll,
- member: Enumerable.include,
- entries: Enumerable.toArray
-});
-var $A = Array.from = function(iterable) {
- if (!iterable) return [];
- if (iterable.toArray) {
- return iterable.toArray();
- } else {
- var results = [];
- for (var i = 0; i < iterable.length; i++)
- results.push(iterable[i]);
- return results;
- }
-}
-
-Object.extend(Array.prototype, Enumerable);
-
-if (!Array.prototype._reverse)
- Array.prototype._reverse = Array.prototype.reverse;
-
-Object.extend(Array.prototype, {
- _each: function(iterator) {
- for (var i = 0; i < this.length; i++)
- iterator(this[i]);
- },
-
- clear: function() {
- this.length = 0;
- return this;
- },
-
- first: function() {
- return this[0];
- },
-
- last: function() {
- return this[this.length - 1];
- },
-
- compact: function() {
- return this.select(function(value) {
- return value != undefined || value != null;
- });
- },
-
- flatten: function() {
- return this.inject([], function(array, value) {
- return array.concat(value && value.constructor == Array ?
- value.flatten() : [value]);
- });
- },
-
- without: function() {
- var values = $A(arguments);
- return this.select(function(value) {
- return !values.include(value);
- });
- },
-
- indexOf: function(object) {
- for (var i = 0; i < this.length; i++)
- if (this[i] == object) return i;
- return -1;
- },
-
- reverse: function(inline) {
- return (inline !== false ? this : this.toArray())._reverse();
- },
-
- inspect: function() {
- return '[' + this.map(Object.inspect).join(', ') + ']';
- }
-});
-var Hash = {
- _each: function(iterator) {
- for (var key in this) {
- var value = this[key];
- if (typeof value == 'function') continue;
-
- var pair = [key, value];
- pair.key = key;
- pair.value = value;
- iterator(pair);
- }
- },
-
- keys: function() {
- return this.pluck('key');
- },
-
- values: function() {
- return this.pluck('value');
- },
-
- merge: function(hash) {
- return $H(hash).inject($H(this), function(mergedHash, pair) {
- mergedHash[pair.key] = pair.value;
- return mergedHash;
- });
- },
-
- toQueryString: function() {
- return this.map(function(pair) {
- return pair.map(encodeURIComponent).join('=');
- }).join('&');
- },
-
- inspect: function() {
- return '#';
- }
-}
-
-function $H(object) {
- var hash = Object.extend({}, object || {});
- Object.extend(hash, Enumerable);
- Object.extend(hash, Hash);
- return hash;
-}
-ObjectRange = Class.create();
-Object.extend(ObjectRange.prototype, Enumerable);
-Object.extend(ObjectRange.prototype, {
- initialize: function(start, end, exclusive) {
- this.start = start;
- this.end = end;
- this.exclusive = exclusive;
- },
-
- _each: function(iterator) {
- var value = this.start;
- do {
- iterator(value);
- value = value.succ();
- } while (this.include(value));
- },
-
- include: function(value) {
- if (value < this.start)
- return false;
- if (this.exclusive)
- return value < this.end;
- return value <= this.end;
- }
-});
-
-var $R = function(start, end, exclusive) {
- return new ObjectRange(start, end, exclusive);
-}
-
-var Ajax = {
- getTransport: function() {
- return Try.these(
- function() {return new XMLHttpRequest()},
- function() {return new ActiveXObject('Msxml2.XMLHTTP')},
- function() {return new ActiveXObject('Microsoft.XMLHTTP')}
- ) || false;
- },
-
- activeRequestCount: 0
-}
-
-Ajax.Responders = {
- responders: [],
-
- _each: function(iterator) {
- this.responders._each(iterator);
- },
-
- register: function(responderToAdd) {
- if (!this.include(responderToAdd))
- this.responders.push(responderToAdd);
- },
-
- unregister: function(responderToRemove) {
- this.responders = this.responders.without(responderToRemove);
- },
-
- dispatch: function(callback, request, transport, json) {
- this.each(function(responder) {
- if (responder[callback] && typeof responder[callback] == 'function') {
- try {
- responder[callback].apply(responder, [request, transport, json]);
- } catch (e) {}
- }
- });
- }
-};
-
-Object.extend(Ajax.Responders, Enumerable);
-
-Ajax.Responders.register({
- onCreate: function() {
- Ajax.activeRequestCount++;
- },
-
- onComplete: function() {
- Ajax.activeRequestCount--;
- }
-});
-
-Ajax.Base = function() {};
-Ajax.Base.prototype = {
- setOptions: function(options) {
- this.options = {
- method: 'post',
- asynchronous: true,
- contentType: 'application/x-www-form-urlencoded',
- parameters: ''
- }
- Object.extend(this.options, options || {});
- },
-
- responseIsSuccess: function() {
- return this.transport.status == undefined
- || this.transport.status == 0
- || (this.transport.status >= 200 && this.transport.status < 300);
- },
-
- responseIsFailure: function() {
- return !this.responseIsSuccess();
- }
-}
-
-Ajax.Request = Class.create();
-Ajax.Request.Events =
- ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];
-
-Ajax.Request.prototype = Object.extend(new Ajax.Base(), {
- initialize: function(url, options) {
- this.transport = Ajax.getTransport();
- this.setOptions(options);
- this.request(url);
- },
-
- request: function(url) {
- var parameters = this.options.parameters || '';
- if (parameters.length > 0) parameters += '&_=';
-
- try {
- this.url = url;
- if (this.options.method == 'get' && parameters.length > 0)
- this.url += (this.url.match(/\?/) ? '&' : '?') + parameters;
-
- Ajax.Responders.dispatch('onCreate', this, this.transport);
-
- this.transport.open(this.options.method, this.url,
- this.options.asynchronous);
-
- if (this.options.asynchronous) {
- this.transport.onreadystatechange = this.onStateChange.bind(this);
- setTimeout((function() {this.respondToReadyState(1)}).bind(this), 10);
- }
-
- this.setRequestHeaders();
-
- var body = this.options.postBody ? this.options.postBody : parameters;
- this.transport.send(this.options.method == 'post' ? body : null);
-
- } catch (e) {
- this.dispatchException(e);
- }
- },
-
- setRequestHeaders: function() {
- var requestHeaders =
- ['X-Requested-With', 'XMLHttpRequest',
- 'X-Prototype-Version', Prototype.Version,
- 'Accept', 'text/javascript, text/html, application/xml, text/xml, */*'];
-
- if (this.options.method == 'post') {
- requestHeaders.push('Content-type', this.options.contentType);
-
- /* Force "Connection: close" for Mozilla browsers to work around
- * a bug where XMLHttpReqeuest sends an incorrect Content-length
- * header. See Mozilla Bugzilla #246651.
- */
- if (this.transport.overrideMimeType)
- requestHeaders.push('Connection', 'close');
- }
-
- if (this.options.requestHeaders)
- requestHeaders.push.apply(requestHeaders, this.options.requestHeaders);
-
- for (var i = 0; i < requestHeaders.length; i += 2)
- this.transport.setRequestHeader(requestHeaders[i], requestHeaders[i+1]);
- },
-
- onStateChange: function() {
- var readyState = this.transport.readyState;
- if (readyState != 1)
- this.respondToReadyState(this.transport.readyState);
- },
-
- header: function(name) {
- try {
- return this.transport.getResponseHeader(name);
- } catch (e) {}
- },
-
- evalJSON: function() {
- try {
- return eval('(' + this.header('X-JSON') + ')');
- } catch (e) {}
- },
-
- evalResponse: function() {
- try {
- return eval(this.transport.responseText);
- } catch (e) {
- this.dispatchException(e);
- }
- },
-
- respondToReadyState: function(readyState) {
- var event = Ajax.Request.Events[readyState];
- var transport = this.transport, json = this.evalJSON();
-
- if (event == 'Complete') {
- try {
- (this.options['on' + this.transport.status]
- || this.options['on' + (this.responseIsSuccess() ? 'Success' : 'Failure')]
- || Prototype.emptyFunction)(transport, json);
- } catch (e) {
- this.dispatchException(e);
- }
-
- if ((this.header('Content-type') || '').match(/^text\/javascript/i))
- this.evalResponse();
- }
-
- try {
- (this.options['on' + event] || Prototype.emptyFunction)(transport, json);
- Ajax.Responders.dispatch('on' + event, this, transport, json);
- } catch (e) {
- this.dispatchException(e);
- }
-
- /* Avoid memory leak in MSIE: clean up the oncomplete event handler */
- if (event == 'Complete')
- this.transport.onreadystatechange = Prototype.emptyFunction;
- },
-
- dispatchException: function(exception) {
- (this.options.onException || Prototype.emptyFunction)(this, exception);
- Ajax.Responders.dispatch('onException', this, exception);
- }
-});
-
-Ajax.Updater = Class.create();
-
-Object.extend(Object.extend(Ajax.Updater.prototype, Ajax.Request.prototype), {
- initialize: function(container, url, options) {
- this.containers = {
- success: container.success ? $(container.success) : $(container),
- failure: container.failure ? $(container.failure) :
- (container.success ? null : $(container))
- }
-
- this.transport = Ajax.getTransport();
- this.setOptions(options);
-
- var onComplete = this.options.onComplete || Prototype.emptyFunction;
- this.options.onComplete = (function(transport, object) {
- this.updateContent();
- onComplete(transport, object);
- }).bind(this);
-
- this.request(url);
- },
-
- updateContent: function() {
- var receiver = this.responseIsSuccess() ?
- this.containers.success : this.containers.failure;
- var response = this.transport.responseText;
-
- if (!this.options.evalScripts)
- response = response.stripScripts();
-
- if (receiver) {
- if (this.options.insertion) {
- new this.options.insertion(receiver, response);
- } else {
- Element.update(receiver, response);
- }
- }
-
- if (this.responseIsSuccess()) {
- if (this.onComplete)
- setTimeout(this.onComplete.bind(this), 10);
- }
- }
-});
-
-Ajax.PeriodicalUpdater = Class.create();
-Ajax.PeriodicalUpdater.prototype = Object.extend(new Ajax.Base(), {
- initialize: function(container, url, options) {
- this.setOptions(options);
- this.onComplete = this.options.onComplete;
-
- this.frequency = (this.options.frequency || 2);
- this.decay = (this.options.decay || 1);
-
- this.updater = {};
- this.container = container;
- this.url = url;
-
- this.start();
- },
-
- start: function() {
- this.options.onComplete = this.updateComplete.bind(this);
- this.onTimerEvent();
- },
-
- stop: function() {
- this.updater.onComplete = undefined;
- clearTimeout(this.timer);
- (this.onComplete || Prototype.emptyFunction).apply(this, arguments);
- },
-
- updateComplete: function(request) {
- if (this.options.decay) {
- this.decay = (request.responseText == this.lastText ?
- this.decay * this.options.decay : 1);
-
- this.lastText = request.responseText;
- }
- this.timer = setTimeout(this.onTimerEvent.bind(this),
- this.decay * this.frequency * 1000);
- },
-
- onTimerEvent: function() {
- this.updater = new Ajax.Updater(this.container, this.url, this.options);
- }
-});
-function $() {
- var results = [], element;
- for (var i = 0; i < arguments.length; i++) {
- element = arguments[i];
- if (typeof element == 'string')
- element = document.getElementById(element);
- results.push(Element.extend(element));
- }
- return results.length < 2 ? results[0] : results;
-}
-
-document.getElementsByClassName = function(className, parentElement) {
- var children = ($(parentElement) || document.body).getElementsByTagName('*');
- return $A(children).inject([], function(elements, child) {
- if (child.className.match(new RegExp("(^|\\s)" + className + "(\\s|$)")))
- elements.push(Element.extend(child));
- return elements;
- });
-}
-
-/*--------------------------------------------------------------------------*/
-
-if (!window.Element)
- var Element = new Object();
-
-Element.extend = function(element) {
- if (!element) return;
- if (_nativeExtensions) return element;
-
- if (!element._extended && element.tagName && element != window) {
- var methods = Element.Methods, cache = Element.extend.cache;
- for (property in methods) {
- var value = methods[property];
- if (typeof value == 'function')
- element[property] = cache.findOrStore(value);
- }
- }
-
- element._extended = true;
- return element;
-}
-
-Element.extend.cache = {
- findOrStore: function(value) {
- return this[value] = this[value] || function() {
- return value.apply(null, [this].concat($A(arguments)));
- }
- }
-}
-
-Element.Methods = {
- visible: function(element) {
- return $(element).style.display != 'none';
- },
-
- toggle: function() {
- for (var i = 0; i < arguments.length; i++) {
- var element = $(arguments[i]);
- Element[Element.visible(element) ? 'hide' : 'show'](element);
- }
- },
-
- hide: function() {
- for (var i = 0; i < arguments.length; i++) {
- var element = $(arguments[i]);
- element.style.display = 'none';
- }
- },
-
- show: function() {
- for (var i = 0; i < arguments.length; i++) {
- var element = $(arguments[i]);
- element.style.display = '';
- }
- },
-
- remove: function(element) {
- element = $(element);
- element.parentNode.removeChild(element);
- },
-
- update: function(element, html) {
- $(element).innerHTML = html.stripScripts();
- setTimeout(function() {html.evalScripts()}, 10);
- },
-
- replace: function(element, html) {
- element = $(element);
- if (element.outerHTML) {
- element.outerHTML = html.stripScripts();
- } else {
- var range = element.ownerDocument.createRange();
- range.selectNodeContents(element);
- element.parentNode.replaceChild(
- range.createContextualFragment(html.stripScripts()), element);
- }
- setTimeout(function() {html.evalScripts()}, 10);
- },
-
- getHeight: function(element) {
- element = $(element);
- return element.offsetHeight;
- },
-
- classNames: function(element) {
- return new Element.ClassNames(element);
- },
-
- hasClassName: function(element, className) {
- if (!(element = $(element))) return;
- return Element.classNames(element).include(className);
- },
-
- addClassName: function(element, className) {
- if (!(element = $(element))) return;
- return Element.classNames(element).add(className);
- },
-
- removeClassName: function(element, className) {
- if (!(element = $(element))) return;
- return Element.classNames(element).remove(className);
- },
-
- // removes whitespace-only text node children
- cleanWhitespace: function(element) {
- element = $(element);
- for (var i = 0; i < element.childNodes.length; i++) {
- var node = element.childNodes[i];
- if (node.nodeType == 3 && !/\S/.test(node.nodeValue))
- Element.remove(node);
- }
- },
-
- empty: function(element) {
- return $(element).innerHTML.match(/^\s*$/);
- },
-
- childOf: function(element, ancestor) {
- element = $(element), ancestor = $(ancestor);
- while (element = element.parentNode)
- if (element == ancestor) return true;
- return false;
- },
-
- scrollTo: function(element) {
- element = $(element);
- var x = element.x ? element.x : element.offsetLeft,
- y = element.y ? element.y : element.offsetTop;
- window.scrollTo(x, y);
- },
-
- getStyle: function(element, style) {
- element = $(element);
- var value = element.style[style.camelize()];
- if (!value) {
- if (document.defaultView && document.defaultView.getComputedStyle) {
- var css = document.defaultView.getComputedStyle(element, null);
- value = css ? css.getPropertyValue(style) : null;
- } else if (element.currentStyle) {
- value = element.currentStyle[style.camelize()];
- }
- }
-
- if (window.opera && ['left', 'top', 'right', 'bottom'].include(style))
- if (Element.getStyle(element, 'position') == 'static') value = 'auto';
-
- return value == 'auto' ? null : value;
- },
-
- setStyle: function(element, style) {
- element = $(element);
- for (var name in style)
- element.style[name.camelize()] = style[name];
- },
-
- getDimensions: function(element) {
- element = $(element);
- if (Element.getStyle(element, 'display') != 'none')
- return {width: element.offsetWidth, height: element.offsetHeight};
-
- // All *Width and *Height properties give 0 on elements with display none,
- // so enable the element temporarily
- var els = element.style;
- var originalVisibility = els.visibility;
- var originalPosition = els.position;
- els.visibility = 'hidden';
- els.position = 'absolute';
- els.display = '';
- var originalWidth = element.clientWidth;
- var originalHeight = element.clientHeight;
- els.display = 'none';
- els.position = originalPosition;
- els.visibility = originalVisibility;
- return {width: originalWidth, height: originalHeight};
- },
-
- makePositioned: function(element) {
- element = $(element);
- var pos = Element.getStyle(element, 'position');
- if (pos == 'static' || !pos) {
- element._madePositioned = true;
- element.style.position = 'relative';
- // Opera returns the offset relative to the positioning context, when an
- // element is position relative but top and left have not been defined
- if (window.opera) {
- element.style.top = 0;
- element.style.left = 0;
- }
- }
- },
-
- undoPositioned: function(element) {
- element = $(element);
- if (element._madePositioned) {
- element._madePositioned = undefined;
- element.style.position =
- element.style.top =
- element.style.left =
- element.style.bottom =
- element.style.right = '';
- }
- },
-
- makeClipping: function(element) {
- element = $(element);
- if (element._overflow) return;
- element._overflow = element.style.overflow;
- if ((Element.getStyle(element, 'overflow') || 'visible') != 'hidden')
- element.style.overflow = 'hidden';
- },
-
- undoClipping: function(element) {
- element = $(element);
- if (element._overflow) return;
- element.style.overflow = element._overflow;
- element._overflow = undefined;
- }
-}
-
-Object.extend(Element, Element.Methods);
-
-var _nativeExtensions = false;
-
-if(!HTMLElement && /Konqueror|Safari|KHTML/.test(navigator.userAgent)) {
- var HTMLElement = {}
- HTMLElement.prototype = document.createElement('div').__proto__;
-}
-
-Element.addMethods = function(methods) {
- Object.extend(Element.Methods, methods || {});
-
- if(typeof HTMLElement != 'undefined') {
- var methods = Element.Methods, cache = Element.extend.cache;
- for (property in methods) {
- var value = methods[property];
- if (typeof value == 'function')
- HTMLElement.prototype[property] = cache.findOrStore(value);
- }
- _nativeExtensions = true;
- }
-}
-
-Element.addMethods();
-
-var Toggle = new Object();
-Toggle.display = Element.toggle;
-
-/*--------------------------------------------------------------------------*/
-
-Abstract.Insertion = function(adjacency) {
- this.adjacency = adjacency;
-}
-
-Abstract.Insertion.prototype = {
- initialize: function(element, content) {
- this.element = $(element);
- this.content = content.stripScripts();
-
- if (this.adjacency && this.element.insertAdjacentHTML) {
- try {
- this.element.insertAdjacentHTML(this.adjacency, this.content);
- } catch (e) {
- var tagName = this.element.tagName.toLowerCase();
- if (tagName == 'tbody' || tagName == 'tr') {
- this.insertContent(this.contentFromAnonymousTable());
- } else {
- throw e;
- }
- }
- } else {
- this.range = this.element.ownerDocument.createRange();
- if (this.initializeRange) this.initializeRange();
- this.insertContent([this.range.createContextualFragment(this.content)]);
- }
-
- setTimeout(function() {content.evalScripts()}, 10);
- },
-
- contentFromAnonymousTable: function() {
- var div = document.createElement('div');
- div.innerHTML = '';
- return $A(div.childNodes[0].childNodes[0].childNodes);
- }
-}
-
-var Insertion = new Object();
-
-Insertion.Before = Class.create();
-Insertion.Before.prototype = Object.extend(new Abstract.Insertion('beforeBegin'), {
- initializeRange: function() {
- this.range.setStartBefore(this.element);
- },
-
- insertContent: function(fragments) {
- fragments.each((function(fragment) {
- this.element.parentNode.insertBefore(fragment, this.element);
- }).bind(this));
- }
-});
-
-Insertion.Top = Class.create();
-Insertion.Top.prototype = Object.extend(new Abstract.Insertion('afterBegin'), {
- initializeRange: function() {
- this.range.selectNodeContents(this.element);
- this.range.collapse(true);
- },
-
- insertContent: function(fragments) {
- fragments.reverse(false).each((function(fragment) {
- this.element.insertBefore(fragment, this.element.firstChild);
- }).bind(this));
- }
-});
-
-Insertion.Bottom = Class.create();
-Insertion.Bottom.prototype = Object.extend(new Abstract.Insertion('beforeEnd'), {
- initializeRange: function() {
- this.range.selectNodeContents(this.element);
- this.range.collapse(this.element);
- },
-
- insertContent: function(fragments) {
- fragments.each((function(fragment) {
- this.element.appendChild(fragment);
- }).bind(this));
- }
-});
-
-Insertion.After = Class.create();
-Insertion.After.prototype = Object.extend(new Abstract.Insertion('afterEnd'), {
- initializeRange: function() {
- this.range.setStartAfter(this.element);
- },
-
- insertContent: function(fragments) {
- fragments.each((function(fragment) {
- this.element.parentNode.insertBefore(fragment,
- this.element.nextSibling);
- }).bind(this));
- }
-});
-
-/*--------------------------------------------------------------------------*/
-
-Element.ClassNames = Class.create();
-Element.ClassNames.prototype = {
- initialize: function(element) {
- this.element = $(element);
- },
-
- _each: function(iterator) {
- this.element.className.split(/\s+/).select(function(name) {
- return name.length > 0;
- })._each(iterator);
- },
-
- set: function(className) {
- this.element.className = className;
- },
-
- add: function(classNameToAdd) {
- if (this.include(classNameToAdd)) return;
- this.set(this.toArray().concat(classNameToAdd).join(' '));
- },
-
- remove: function(classNameToRemove) {
- if (!this.include(classNameToRemove)) return;
- this.set(this.select(function(className) {
- return className != classNameToRemove;
- }).join(' '));
- },
-
- toString: function() {
- return this.toArray().join(' ');
- }
-}
-
-Object.extend(Element.ClassNames.prototype, Enumerable);
-var Selector = Class.create();
-Selector.prototype = {
- initialize: function(expression) {
- this.params = {classNames: []};
- this.expression = expression.toString().strip();
- this.parseExpression();
- this.compileMatcher();
- },
-
- parseExpression: function() {
- function abort(message) { throw 'Parse error in selector: ' + message; }
-
- if (this.expression == '') abort('empty expression');
-
- var params = this.params, expr = this.expression, match, modifier, clause, rest;
- while (match = expr.match(/^(.*)\[([a-z0-9_:-]+?)(?:([~\|!]?=)(?:"([^"]*)"|([^\]\s]*)))?\]$/i)) {
- params.attributes = params.attributes || [];
- params.attributes.push({name: match[2], operator: match[3], value: match[4] || match[5] || ''});
- expr = match[1];
- }
-
- if (expr == '*') return this.params.wildcard = true;
-
- while (match = expr.match(/^([^a-z0-9_-])?([a-z0-9_-]+)(.*)/i)) {
- modifier = match[1], clause = match[2], rest = match[3];
- switch (modifier) {
- case '#': params.id = clause; break;
- case '.': params.classNames.push(clause); break;
- case '':
- case undefined: params.tagName = clause.toUpperCase(); break;
- default: abort(expr.inspect());
- }
- expr = rest;
- }
-
- if (expr.length > 0) abort(expr.inspect());
- },
-
- buildMatchExpression: function() {
- var params = this.params, conditions = [], clause;
-
- if (params.wildcard)
- conditions.push('true');
- if (clause = params.id)
- conditions.push('element.id == ' + clause.inspect());
- if (clause = params.tagName)
- conditions.push('element.tagName.toUpperCase() == ' + clause.inspect());
- if ((clause = params.classNames).length > 0)
- for (var i = 0; i < clause.length; i++)
- conditions.push('Element.hasClassName(element, ' + clause[i].inspect() + ')');
- if (clause = params.attributes) {
- clause.each(function(attribute) {
- var value = 'element.getAttribute(' + attribute.name.inspect() + ')';
- var splitValueBy = function(delimiter) {
- return value + ' && ' + value + '.split(' + delimiter.inspect() + ')';
- }
-
- switch (attribute.operator) {
- case '=': conditions.push(value + ' == ' + attribute.value.inspect()); break;
- case '~=': conditions.push(splitValueBy(' ') + '.include(' + attribute.value.inspect() + ')'); break;
- case '|=': conditions.push(
- splitValueBy('-') + '.first().toUpperCase() == ' + attribute.value.toUpperCase().inspect()
- ); break;
- case '!=': conditions.push(value + ' != ' + attribute.value.inspect()); break;
- case '':
- case undefined: conditions.push(value + ' != null'); break;
- default: throw 'Unknown operator ' + attribute.operator + ' in selector';
- }
- });
- }
-
- return conditions.join(' && ');
- },
-
- compileMatcher: function() {
- this.match = new Function('element', 'if (!element.tagName) return false; \n' +
- 'return ' + this.buildMatchExpression());
- },
-
- findElements: function(scope) {
- var element;
-
- if (element = $(this.params.id))
- if (this.match(element))
- if (!scope || Element.childOf(element, scope))
- return [element];
-
- scope = (scope || document).getElementsByTagName(this.params.tagName || '*');
-
- var results = [];
- for (var i = 0; i < scope.length; i++)
- if (this.match(element = scope[i]))
- results.push(Element.extend(element));
-
- return results;
- },
-
- toString: function() {
- return this.expression;
- }
-}
-
-function $$() {
- return $A(arguments).map(function(expression) {
- return expression.strip().split(/\s+/).inject([null], function(results, expr) {
- var selector = new Selector(expr);
- return results.map(selector.findElements.bind(selector)).flatten();
- });
- }).flatten();
-}
-var Field = {
- clear: function() {
- for (var i = 0; i < arguments.length; i++)
- $(arguments[i]).value = '';
- },
-
- focus: function(element) {
- $(element).focus();
- },
-
- present: function() {
- for (var i = 0; i < arguments.length; i++)
- if ($(arguments[i]).value == '') return false;
- return true;
- },
-
- select: function(element) {
- $(element).select();
- },
-
- activate: function(element) {
- element = $(element);
- element.focus();
- if (element.select)
- element.select();
- }
-}
-
-/*--------------------------------------------------------------------------*/
-
-var Form = {
- serialize: function(form) {
- var elements = Form.getElements($(form));
- var queryComponents = new Array();
-
- for (var i = 0; i < elements.length; i++) {
- var queryComponent = Form.Element.serialize(elements[i]);
- if (queryComponent)
- queryComponents.push(queryComponent);
- }
-
- return queryComponents.join('&');
- },
-
- getElements: function(form) {
- form = $(form);
- var elements = new Array();
-
- for (var tagName in Form.Element.Serializers) {
- var tagElements = form.getElementsByTagName(tagName);
- for (var j = 0; j < tagElements.length; j++)
- elements.push(tagElements[j]);
- }
- return elements;
- },
-
- getInputs: function(form, typeName, name) {
- form = $(form);
- var inputs = form.getElementsByTagName('input');
-
- if (!typeName && !name)
- return inputs;
-
- var matchingInputs = new Array();
- for (var i = 0; i < inputs.length; i++) {
- var input = inputs[i];
- if ((typeName && input.type != typeName) ||
- (name && input.name != name))
- continue;
- matchingInputs.push(input);
- }
-
- return matchingInputs;
- },
-
- disable: function(form) {
- var elements = Form.getElements(form);
- for (var i = 0; i < elements.length; i++) {
- var element = elements[i];
- element.blur();
- element.disabled = 'true';
- }
- },
-
- enable: function(form) {
- var elements = Form.getElements(form);
- for (var i = 0; i < elements.length; i++) {
- var element = elements[i];
- element.disabled = '';
- }
- },
-
- findFirstElement: function(form) {
- return Form.getElements(form).find(function(element) {
- return element.type != 'hidden' && !element.disabled &&
- ['input', 'select', 'textarea'].include(element.tagName.toLowerCase());
- });
- },
-
- focusFirstElement: function(form) {
- Field.activate(Form.findFirstElement(form));
- },
-
- reset: function(form) {
- $(form).reset();
- }
-}
-
-Form.Element = {
- serialize: function(element) {
- element = $(element);
- var method = element.tagName.toLowerCase();
- var parameter = Form.Element.Serializers[method](element);
-
- if (parameter) {
- var key = encodeURIComponent(parameter[0]);
- if (key.length == 0) return;
-
- if (parameter[1].constructor != Array)
- parameter[1] = [parameter[1]];
-
- return parameter[1].map(function(value) {
- return key + '=' + encodeURIComponent(value);
- }).join('&');
- }
- },
-
- getValue: function(element) {
- element = $(element);
- var method = element.tagName.toLowerCase();
- var parameter = Form.Element.Serializers[method](element);
-
- if (parameter)
- return parameter[1];
- }
-}
-
-Form.Element.Serializers = {
- input: function(element) {
- switch (element.type.toLowerCase()) {
- case 'submit':
- case 'hidden':
- case 'password':
- case 'text':
- return Form.Element.Serializers.textarea(element);
- case 'checkbox':
- case 'radio':
- return Form.Element.Serializers.inputSelector(element);
- }
- return false;
- },
-
- inputSelector: function(element) {
- if (element.checked)
- return [element.name, element.value];
- },
-
- textarea: function(element) {
- return [element.name, element.value];
- },
-
- select: function(element) {
- return Form.Element.Serializers[element.type == 'select-one' ?
- 'selectOne' : 'selectMany'](element);
- },
-
- selectOne: function(element) {
- var value = '', opt, index = element.selectedIndex;
- if (index >= 0) {
- opt = element.options[index];
- value = opt.value || opt.text;
- }
- return [element.name, value];
- },
-
- selectMany: function(element) {
- var value = [];
- for (var i = 0; i < element.length; i++) {
- var opt = element.options[i];
- if (opt.selected)
- value.push(opt.value || opt.text);
- }
- return [element.name, value];
- }
-}
-
-/*--------------------------------------------------------------------------*/
-
-var $F = Form.Element.getValue;
-
-/*--------------------------------------------------------------------------*/
-
-Abstract.TimedObserver = function() {}
-Abstract.TimedObserver.prototype = {
- initialize: function(element, frequency, callback) {
- this.frequency = frequency;
- this.element = $(element);
- this.callback = callback;
-
- this.lastValue = this.getValue();
- this.registerCallback();
- },
-
- registerCallback: function() {
- setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
- },
-
- onTimerEvent: function() {
- var value = this.getValue();
- if (this.lastValue != value) {
- this.callback(this.element, value);
- this.lastValue = value;
- }
- }
-}
-
-Form.Element.Observer = Class.create();
-Form.Element.Observer.prototype = Object.extend(new Abstract.TimedObserver(), {
- getValue: function() {
- return Form.Element.getValue(this.element);
- }
-});
-
-Form.Observer = Class.create();
-Form.Observer.prototype = Object.extend(new Abstract.TimedObserver(), {
- getValue: function() {
- return Form.serialize(this.element);
- }
-});
-
-/*--------------------------------------------------------------------------*/
-
-Abstract.EventObserver = function() {}
-Abstract.EventObserver.prototype = {
- initialize: function(element, callback) {
- this.element = $(element);
- this.callback = callback;
-
- this.lastValue = this.getValue();
- if (this.element.tagName.toLowerCase() == 'form')
- this.registerFormCallbacks();
- else
- this.registerCallback(this.element);
- },
-
- onElementEvent: function() {
- var value = this.getValue();
- if (this.lastValue != value) {
- this.callback(this.element, value);
- this.lastValue = value;
- }
- },
-
- registerFormCallbacks: function() {
- var elements = Form.getElements(this.element);
- for (var i = 0; i < elements.length; i++)
- this.registerCallback(elements[i]);
- },
-
- registerCallback: function(element) {
- if (element.type) {
- switch (element.type.toLowerCase()) {
- case 'checkbox':
- case 'radio':
- Event.observe(element, 'click', this.onElementEvent.bind(this));
- break;
- case 'password':
- case 'text':
- case 'textarea':
- case 'select-one':
- case 'select-multiple':
- Event.observe(element, 'change', this.onElementEvent.bind(this));
- break;
- }
- }
- }
-}
-
-Form.Element.EventObserver = Class.create();
-Form.Element.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), {
- getValue: function() {
- return Form.Element.getValue(this.element);
- }
-});
-
-Form.EventObserver = Class.create();
-Form.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), {
- getValue: function() {
- return Form.serialize(this.element);
- }
-});
-if (!window.Event) {
- var Event = new Object();
-}
-
-Object.extend(Event, {
- KEY_BACKSPACE: 8,
- KEY_TAB: 9,
- KEY_RETURN: 13,
- KEY_ESC: 27,
- KEY_LEFT: 37,
- KEY_UP: 38,
- KEY_RIGHT: 39,
- KEY_DOWN: 40,
- KEY_DELETE: 46,
-
- element: function(event) {
- return event.target || event.srcElement;
- },
-
- isLeftClick: function(event) {
- return (((event.which) && (event.which == 1)) ||
- ((event.button) && (event.button == 1)));
- },
-
- pointerX: function(event) {
- return event.pageX || (event.clientX +
- (document.documentElement.scrollLeft || document.body.scrollLeft));
- },
-
- pointerY: function(event) {
- return event.pageY || (event.clientY +
- (document.documentElement.scrollTop || document.body.scrollTop));
- },
-
- stop: function(event) {
- if (event.preventDefault) {
- event.preventDefault();
- event.stopPropagation();
- } else {
- event.returnValue = false;
- event.cancelBubble = true;
- }
- },
-
- // find the first node with the given tagName, starting from the
- // node the event was triggered on; traverses the DOM upwards
- findElement: function(event, tagName) {
- var element = Event.element(event);
- while (element.parentNode && (!element.tagName ||
- (element.tagName.toUpperCase() != tagName.toUpperCase())))
- element = element.parentNode;
- return element;
- },
-
- observers: false,
-
- _observeAndCache: function(element, name, observer, useCapture) {
- if (!this.observers) this.observers = [];
- if (element.addEventListener) {
- this.observers.push([element, name, observer, useCapture]);
- element.addEventListener(name, observer, useCapture);
- } else if (element.attachEvent) {
- this.observers.push([element, name, observer, useCapture]);
- element.attachEvent('on' + name, observer);
- }
- },
-
- unloadCache: function() {
- if (!Event.observers) return;
- for (var i = 0; i < Event.observers.length; i++) {
- Event.stopObserving.apply(this, Event.observers[i]);
- Event.observers[i][0] = null;
- }
- Event.observers = false;
- },
-
- observe: function(element, name, observer, useCapture) {
- var element = $(element);
- useCapture = useCapture || false;
-
- if (name == 'keypress' &&
- (navigator.appVersion.match(/Konqueror|Safari|KHTML/)
- || element.attachEvent))
- name = 'keydown';
-
- this._observeAndCache(element, name, observer, useCapture);
- },
-
- stopObserving: function(element, name, observer, useCapture) {
- var element = $(element);
- useCapture = useCapture || false;
-
- if (name == 'keypress' &&
- (navigator.appVersion.match(/Konqueror|Safari|KHTML/)
- || element.detachEvent))
- name = 'keydown';
-
- if (element.removeEventListener) {
- element.removeEventListener(name, observer, useCapture);
- } else if (element.detachEvent) {
- element.detachEvent('on' + name, observer);
- }
- }
-});
-
-/* prevent memory leaks in IE */
-if (navigator.appVersion.match(/\bMSIE\b/))
- Event.observe(window, 'unload', Event.unloadCache, false);
-var Position = {
- // set to true if needed, warning: firefox performance problems
- // NOT neeeded for page scrolling, only if draggable contained in
- // scrollable elements
- includeScrollOffsets: false,
-
- // must be called before calling withinIncludingScrolloffset, every time the
- // page is scrolled
- prepare: function() {
- this.deltaX = window.pageXOffset
- || document.documentElement.scrollLeft
- || document.body.scrollLeft
- || 0;
- this.deltaY = window.pageYOffset
- || document.documentElement.scrollTop
- || document.body.scrollTop
- || 0;
- },
-
- realOffset: function(element) {
- var valueT = 0, valueL = 0;
- do {
- valueT += element.scrollTop || 0;
- valueL += element.scrollLeft || 0;
- element = element.parentNode;
- } while (element);
- return [valueL, valueT];
- },
-
- cumulativeOffset: function(element) {
- var valueT = 0, valueL = 0;
- do {
- valueT += element.offsetTop || 0;
- valueL += element.offsetLeft || 0;
- element = element.offsetParent;
- } while (element);
- return [valueL, valueT];
- },
-
- positionedOffset: function(element) {
- var valueT = 0, valueL = 0;
- do {
- valueT += element.offsetTop || 0;
- valueL += element.offsetLeft || 0;
- element = element.offsetParent;
- if (element) {
- p = Element.getStyle(element, 'position');
- if (p == 'relative' || p == 'absolute') break;
- }
- } while (element);
- return [valueL, valueT];
- },
-
- offsetParent: function(element) {
- if (element.offsetParent) return element.offsetParent;
- if (element == document.body) return element;
-
- while ((element = element.parentNode) && element != document.body)
- if (Element.getStyle(element, 'position') != 'static')
- return element;
-
- return document.body;
- },
-
- // caches x/y coordinate pair to use with overlap
- within: function(element, x, y) {
- if (this.includeScrollOffsets)
- return this.withinIncludingScrolloffsets(element, x, y);
- this.xcomp = x;
- this.ycomp = y;
- this.offset = this.cumulativeOffset(element);
-
- return (y >= this.offset[1] &&
- y < this.offset[1] + element.offsetHeight &&
- x >= this.offset[0] &&
- x < this.offset[0] + element.offsetWidth);
- },
-
- withinIncludingScrolloffsets: function(element, x, y) {
- var offsetcache = this.realOffset(element);
-
- this.xcomp = x + offsetcache[0] - this.deltaX;
- this.ycomp = y + offsetcache[1] - this.deltaY;
- this.offset = this.cumulativeOffset(element);
-
- return (this.ycomp >= this.offset[1] &&
- this.ycomp < this.offset[1] + element.offsetHeight &&
- this.xcomp >= this.offset[0] &&
- this.xcomp < this.offset[0] + element.offsetWidth);
- },
-
- // within must be called directly before
- overlap: function(mode, element) {
- if (!mode) return 0;
- if (mode == 'vertical')
- return ((this.offset[1] + element.offsetHeight) - this.ycomp) /
- element.offsetHeight;
- if (mode == 'horizontal')
- return ((this.offset[0] + element.offsetWidth) - this.xcomp) /
- element.offsetWidth;
- },
-
- clone: function(source, target) {
- source = $(source);
- target = $(target);
- target.style.position = 'absolute';
- var offsets = this.cumulativeOffset(source);
- target.style.top = offsets[1] + 'px';
- target.style.left = offsets[0] + 'px';
- target.style.width = source.offsetWidth + 'px';
- target.style.height = source.offsetHeight + 'px';
- },
-
- page: function(forElement) {
- var valueT = 0, valueL = 0;
-
- var element = forElement;
- do {
- valueT += element.offsetTop || 0;
- valueL += element.offsetLeft || 0;
-
- // Safari fix
- if (element.offsetParent==document.body)
- if (Element.getStyle(element,'position')=='absolute') break;
-
- } while (element = element.offsetParent);
-
- element = forElement;
- do {
- valueT -= element.scrollTop || 0;
- valueL -= element.scrollLeft || 0;
- } while (element = element.parentNode);
-
- return [valueL, valueT];
- },
-
- clone: function(source, target) {
- var options = Object.extend({
- setLeft: true,
- setTop: true,
- setWidth: true,
- setHeight: true,
- offsetTop: 0,
- offsetLeft: 0
- }, arguments[2] || {})
-
- // find page position of source
- source = $(source);
- var p = Position.page(source);
-
- // find coordinate system to use
- target = $(target);
- var delta = [0, 0];
- var parent = null;
- // delta [0,0] will do fine with position: fixed elements,
- // position:absolute needs offsetParent deltas
- if (Element.getStyle(target,'position') == 'absolute') {
- parent = Position.offsetParent(target);
- delta = Position.page(parent);
- }
-
- // correct by body offsets (fixes Safari)
- if (parent == document.body) {
- delta[0] -= document.body.offsetLeft;
- delta[1] -= document.body.offsetTop;
- }
-
- // set position
- if(options.setLeft) target.style.left = (p[0] - delta[0] + options.offsetLeft) + 'px';
- if(options.setTop) target.style.top = (p[1] - delta[1] + options.offsetTop) + 'px';
- if(options.setWidth) target.style.width = source.offsetWidth + 'px';
- if(options.setHeight) target.style.height = source.offsetHeight + 'px';
- },
-
- absolutize: function(element) {
- element = $(element);
- if (element.style.position == 'absolute') return;
- Position.prepare();
-
- var offsets = Position.positionedOffset(element);
- var top = offsets[1];
- var left = offsets[0];
- var width = element.clientWidth;
- var height = element.clientHeight;
-
- element._originalLeft = left - parseFloat(element.style.left || 0);
- element._originalTop = top - parseFloat(element.style.top || 0);
- element._originalWidth = element.style.width;
- element._originalHeight = element.style.height;
-
- element.style.position = 'absolute';
- element.style.top = top + 'px';;
- element.style.left = left + 'px';;
- element.style.width = width + 'px';;
- element.style.height = height + 'px';;
- },
-
- relativize: function(element) {
- element = $(element);
- if (element.style.position == 'relative') return;
- Position.prepare();
-
- element.style.position = 'relative';
- var top = parseFloat(element.style.top || 0) - (element._originalTop || 0);
- var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0);
-
- element.style.top = top + 'px';
- element.style.left = left + 'px';
- element.style.height = element._originalHeight;
- element.style.width = element._originalWidth;
- }
-}
-
-// Safari returns margins on body which is incorrect if the child is absolutely
-// positioned. For performance reasons, redefine Position.cumulativeOffset for
-// KHTML/WebKit only.
-if (/Konqueror|Safari|KHTML/.test(navigator.userAgent)) {
- Position.cumulativeOffset = function(element) {
- var valueT = 0, valueL = 0;
- do {
- valueT += element.offsetTop || 0;
- valueL += element.offsetLeft || 0;
- if (element.offsetParent == document.body)
- if (Element.getStyle(element, 'position') == 'absolute') break;
-
- element = element.offsetParent;
- } while (element);
-
- return [valueL, valueT];
- }
-}
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/selenium-core/lib/scriptaculous/builder.js b/vendor/plugins/selenium-on-rails/selenium-core/lib/scriptaculous/builder.js
deleted file mode 100644
index 5b15ba93..00000000
--- a/vendor/plugins/selenium-on-rails/selenium-core/lib/scriptaculous/builder.js
+++ /dev/null
@@ -1,101 +0,0 @@
-// Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
-//
-// See scriptaculous.js for full license.
-
-var Builder = {
- NODEMAP: {
- AREA: 'map',
- CAPTION: 'table',
- COL: 'table',
- COLGROUP: 'table',
- LEGEND: 'fieldset',
- OPTGROUP: 'select',
- OPTION: 'select',
- PARAM: 'object',
- TBODY: 'table',
- TD: 'table',
- TFOOT: 'table',
- TH: 'table',
- THEAD: 'table',
- TR: 'table'
- },
- // note: For Firefox < 1.5, OPTION and OPTGROUP tags are currently broken,
- // due to a Firefox bug
- node: function(elementName) {
- elementName = elementName.toUpperCase();
-
- // try innerHTML approach
- var parentTag = this.NODEMAP[elementName] || 'div';
- var parentElement = document.createElement(parentTag);
- try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707
- parentElement.innerHTML = "<" + elementName + ">" + elementName + ">";
- } catch(e) {}
- var element = parentElement.firstChild || null;
-
- // see if browser added wrapping tags
- if(element && (element.tagName != elementName))
- element = element.getElementsByTagName(elementName)[0];
-
- // fallback to createElement approach
- if(!element) element = document.createElement(elementName);
-
- // abort if nothing could be created
- if(!element) return;
-
- // attributes (or text)
- if(arguments[1])
- if(this._isStringOrNumber(arguments[1]) ||
- (arguments[1] instanceof Array)) {
- this._children(element, arguments[1]);
- } else {
- var attrs = this._attributes(arguments[1]);
- if(attrs.length) {
- try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707
- parentElement.innerHTML = "<" +elementName + " " +
- attrs + ">" + elementName + ">";
- } catch(e) {}
- element = parentElement.firstChild || null;
- // workaround firefox 1.0.X bug
- if(!element) {
- element = document.createElement(elementName);
- for(attr in arguments[1])
- element[attr == 'class' ? 'className' : attr] = arguments[1][attr];
- }
- if(element.tagName != elementName)
- element = parentElement.getElementsByTagName(elementName)[0];
- }
- }
-
- // text, or array of children
- if(arguments[2])
- this._children(element, arguments[2]);
-
- return element;
- },
- _text: function(text) {
- return document.createTextNode(text);
- },
- _attributes: function(attributes) {
- var attrs = [];
- for(attribute in attributes)
- attrs.push((attribute=='className' ? 'class' : attribute) +
- '="' + attributes[attribute].toString().escapeHTML() + '"');
- return attrs.join(" ");
- },
- _children: function(element, children) {
- if(typeof children=='object') { // array can hold nodes and text
- children.flatten().each( function(e) {
- if(typeof e=='object')
- element.appendChild(e)
- else
- if(Builder._isStringOrNumber(e))
- element.appendChild(Builder._text(e));
- });
- } else
- if(Builder._isStringOrNumber(children))
- element.appendChild(Builder._text(children));
- },
- _isStringOrNumber: function(param) {
- return(typeof param=='string' || typeof param=='number');
- }
-}
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/selenium-core/lib/scriptaculous/controls.js b/vendor/plugins/selenium-on-rails/selenium-core/lib/scriptaculous/controls.js
deleted file mode 100644
index de0261ed..00000000
--- a/vendor/plugins/selenium-on-rails/selenium-core/lib/scriptaculous/controls.js
+++ /dev/null
@@ -1,815 +0,0 @@
-// Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
-// (c) 2005 Ivan Krstic (http://blogs.law.harvard.edu/ivan)
-// (c) 2005 Jon Tirsen (http://www.tirsen.com)
-// Contributors:
-// Richard Livsey
-// Rahul Bhargava
-// Rob Wills
-//
-// See scriptaculous.js for full license.
-
-// Autocompleter.Base handles all the autocompletion functionality
-// that's independent of the data source for autocompletion. This
-// includes drawing the autocompletion menu, observing keyboard
-// and mouse events, and similar.
-//
-// Specific autocompleters need to provide, at the very least,
-// a getUpdatedChoices function that will be invoked every time
-// the text inside the monitored textbox changes. This method
-// should get the text for which to provide autocompletion by
-// invoking this.getToken(), NOT by directly accessing
-// this.element.value. This is to allow incremental tokenized
-// autocompletion. Specific auto-completion logic (AJAX, etc)
-// belongs in getUpdatedChoices.
-//
-// Tokenized incremental autocompletion is enabled automatically
-// when an autocompleter is instantiated with the 'tokens' option
-// in the options parameter, e.g.:
-// new Ajax.Autocompleter('id','upd', '/url/', { tokens: ',' });
-// will incrementally autocomplete with a comma as the token.
-// Additionally, ',' in the above example can be replaced with
-// a token array, e.g. { tokens: [',', '\n'] } which
-// enables autocompletion on multiple tokens. This is most
-// useful when one of the tokens is \n (a newline), as it
-// allows smart autocompletion after linebreaks.
-
-var Autocompleter = {}
-Autocompleter.Base = function() {};
-Autocompleter.Base.prototype = {
- baseInitialize: function(element, update, options) {
- this.element = $(element);
- this.update = $(update);
- this.hasFocus = false;
- this.changed = false;
- this.active = false;
- this.index = 0;
- this.entryCount = 0;
-
- if (this.setOptions)
- this.setOptions(options);
- else
- this.options = options || {};
-
- this.options.paramName = this.options.paramName || this.element.name;
- this.options.tokens = this.options.tokens || [];
- this.options.frequency = this.options.frequency || 0.4;
- this.options.minChars = this.options.minChars || 1;
- this.options.onShow = this.options.onShow ||
- function(element, update){
- if(!update.style.position || update.style.position=='absolute') {
- update.style.position = 'absolute';
- Position.clone(element, update, {setHeight: false, offsetTop: element.offsetHeight});
- }
- Effect.Appear(update,{duration:0.15});
- };
- this.options.onHide = this.options.onHide ||
- function(element, update){ new Effect.Fade(update,{duration:0.15}) };
-
- if (typeof(this.options.tokens) == 'string')
- this.options.tokens = new Array(this.options.tokens);
-
- this.observer = null;
-
- this.element.setAttribute('autocomplete','off');
-
- Element.hide(this.update);
-
- Event.observe(this.element, "blur", this.onBlur.bindAsEventListener(this));
- Event.observe(this.element, "keypress", this.onKeyPress.bindAsEventListener(this));
- },
-
- show: function() {
- if(Element.getStyle(this.update, 'display')=='none') this.options.onShow(this.element, this.update);
- if(!this.iefix &&
- (navigator.appVersion.indexOf('MSIE')>0) &&
- (navigator.userAgent.indexOf('Opera')<0) &&
- (Element.getStyle(this.update, 'position')=='absolute')) {
- new Insertion.After(this.update,
- '');
- this.iefix = $(this.update.id+'_iefix');
- }
- if(this.iefix) setTimeout(this.fixIEOverlapping.bind(this), 50);
- },
-
- fixIEOverlapping: function() {
- Position.clone(this.update, this.iefix);
- this.iefix.style.zIndex = 1;
- this.update.style.zIndex = 2;
- Element.show(this.iefix);
- },
-
- hide: function() {
- this.stopIndicator();
- if(Element.getStyle(this.update, 'display')!='none') this.options.onHide(this.element, this.update);
- if(this.iefix) Element.hide(this.iefix);
- },
-
- startIndicator: function() {
- if(this.options.indicator) Element.show(this.options.indicator);
- },
-
- stopIndicator: function() {
- if(this.options.indicator) Element.hide(this.options.indicator);
- },
-
- onKeyPress: function(event) {
- if(this.active)
- switch(event.keyCode) {
- case Event.KEY_TAB:
- case Event.KEY_RETURN:
- this.selectEntry();
- Event.stop(event);
- case Event.KEY_ESC:
- this.hide();
- this.active = false;
- Event.stop(event);
- return;
- case Event.KEY_LEFT:
- case Event.KEY_RIGHT:
- return;
- case Event.KEY_UP:
- this.markPrevious();
- this.render();
- if(navigator.appVersion.indexOf('AppleWebKit')>0) Event.stop(event);
- return;
- case Event.KEY_DOWN:
- this.markNext();
- this.render();
- if(navigator.appVersion.indexOf('AppleWebKit')>0) Event.stop(event);
- return;
- }
- else
- if(event.keyCode==Event.KEY_TAB || event.keyCode==Event.KEY_RETURN ||
- (navigator.appVersion.indexOf('AppleWebKit') > 0 && event.keyCode == 0)) return;
-
- this.changed = true;
- this.hasFocus = true;
-
- if(this.observer) clearTimeout(this.observer);
- this.observer =
- setTimeout(this.onObserverEvent.bind(this), this.options.frequency*1000);
- },
-
- activate: function() {
- this.changed = false;
- this.hasFocus = true;
- this.getUpdatedChoices();
- },
-
- onHover: function(event) {
- var element = Event.findElement(event, 'LI');
- if(this.index != element.autocompleteIndex)
- {
- this.index = element.autocompleteIndex;
- this.render();
- }
- Event.stop(event);
- },
-
- onClick: function(event) {
- var element = Event.findElement(event, 'LI');
- this.index = element.autocompleteIndex;
- this.selectEntry();
- this.hide();
- },
-
- onBlur: function(event) {
- // needed to make click events working
- setTimeout(this.hide.bind(this), 250);
- this.hasFocus = false;
- this.active = false;
- },
-
- render: function() {
- if(this.entryCount > 0) {
- for (var i = 0; i < this.entryCount; i++)
- this.index==i ?
- Element.addClassName(this.getEntry(i),"selected") :
- Element.removeClassName(this.getEntry(i),"selected");
-
- if(this.hasFocus) {
- this.show();
- this.active = true;
- }
- } else {
- this.active = false;
- this.hide();
- }
- },
-
- markPrevious: function() {
- if(this.index > 0) this.index--
- else this.index = this.entryCount-1;
- },
-
- markNext: function() {
- if(this.index < this.entryCount-1) this.index++
- else this.index = 0;
- },
-
- getEntry: function(index) {
- return this.update.firstChild.childNodes[index];
- },
-
- getCurrentEntry: function() {
- return this.getEntry(this.index);
- },
-
- selectEntry: function() {
- this.active = false;
- this.updateElement(this.getCurrentEntry());
- },
-
- updateElement: function(selectedElement) {
- if (this.options.updateElement) {
- this.options.updateElement(selectedElement);
- return;
- }
- var value = '';
- if (this.options.select) {
- var nodes = document.getElementsByClassName(this.options.select, selectedElement) || [];
- if(nodes.length>0) value = Element.collectTextNodes(nodes[0], this.options.select);
- } else
- value = Element.collectTextNodesIgnoreClass(selectedElement, 'informal');
-
- var lastTokenPos = this.findLastToken();
- if (lastTokenPos != -1) {
- var newValue = this.element.value.substr(0, lastTokenPos + 1);
- var whitespace = this.element.value.substr(lastTokenPos + 1).match(/^\s+/);
- if (whitespace)
- newValue += whitespace[0];
- this.element.value = newValue + value;
- } else {
- this.element.value = value;
- }
- this.element.focus();
-
- if (this.options.afterUpdateElement)
- this.options.afterUpdateElement(this.element, selectedElement);
- },
-
- updateChoices: function(choices) {
- if(!this.changed && this.hasFocus) {
- this.update.innerHTML = choices;
- Element.cleanWhitespace(this.update);
- Element.cleanWhitespace(this.update.firstChild);
-
- if(this.update.firstChild && this.update.firstChild.childNodes) {
- this.entryCount =
- this.update.firstChild.childNodes.length;
- for (var i = 0; i < this.entryCount; i++) {
- var entry = this.getEntry(i);
- entry.autocompleteIndex = i;
- this.addObservers(entry);
- }
- } else {
- this.entryCount = 0;
- }
-
- this.stopIndicator();
-
- this.index = 0;
- this.render();
- }
- },
-
- addObservers: function(element) {
- Event.observe(element, "mouseover", this.onHover.bindAsEventListener(this));
- Event.observe(element, "click", this.onClick.bindAsEventListener(this));
- },
-
- onObserverEvent: function() {
- this.changed = false;
- if(this.getToken().length>=this.options.minChars) {
- this.startIndicator();
- this.getUpdatedChoices();
- } else {
- this.active = false;
- this.hide();
- }
- },
-
- getToken: function() {
- var tokenPos = this.findLastToken();
- if (tokenPos != -1)
- var ret = this.element.value.substr(tokenPos + 1).replace(/^\s+/,'').replace(/\s+$/,'');
- else
- var ret = this.element.value;
-
- return /\n/.test(ret) ? '' : ret;
- },
-
- findLastToken: function() {
- var lastTokenPos = -1;
-
- for (var i=0; i lastTokenPos)
- lastTokenPos = thisTokenPos;
- }
- return lastTokenPos;
- }
-}
-
-Ajax.Autocompleter = Class.create();
-Object.extend(Object.extend(Ajax.Autocompleter.prototype, Autocompleter.Base.prototype), {
- initialize: function(element, update, url, options) {
- this.baseInitialize(element, update, options);
- this.options.asynchronous = true;
- this.options.onComplete = this.onComplete.bind(this);
- this.options.defaultParams = this.options.parameters || null;
- this.url = url;
- },
-
- getUpdatedChoices: function() {
- entry = encodeURIComponent(this.options.paramName) + '=' +
- encodeURIComponent(this.getToken());
-
- this.options.parameters = this.options.callback ?
- this.options.callback(this.element, entry) : entry;
-
- if(this.options.defaultParams)
- this.options.parameters += '&' + this.options.defaultParams;
-
- new Ajax.Request(this.url, this.options);
- },
-
- onComplete: function(request) {
- this.updateChoices(request.responseText);
- }
-
-});
-
-// The local array autocompleter. Used when you'd prefer to
-// inject an array of autocompletion options into the page, rather
-// than sending out Ajax queries, which can be quite slow sometimes.
-//
-// The constructor takes four parameters. The first two are, as usual,
-// the id of the monitored textbox, and id of the autocompletion menu.
-// The third is the array you want to autocomplete from, and the fourth
-// is the options block.
-//
-// Extra local autocompletion options:
-// - choices - How many autocompletion choices to offer
-//
-// - partialSearch - If false, the autocompleter will match entered
-// text only at the beginning of strings in the
-// autocomplete array. Defaults to true, which will
-// match text at the beginning of any *word* in the
-// strings in the autocomplete array. If you want to
-// search anywhere in the string, additionally set
-// the option fullSearch to true (default: off).
-//
-// - fullSsearch - Search anywhere in autocomplete array strings.
-//
-// - partialChars - How many characters to enter before triggering
-// a partial match (unlike minChars, which defines
-// how many characters are required to do any match
-// at all). Defaults to 2.
-//
-// - ignoreCase - Whether to ignore case when autocompleting.
-// Defaults to true.
-//
-// It's possible to pass in a custom function as the 'selector'
-// option, if you prefer to write your own autocompletion logic.
-// In that case, the other options above will not apply unless
-// you support them.
-
-Autocompleter.Local = Class.create();
-Autocompleter.Local.prototype = Object.extend(new Autocompleter.Base(), {
- initialize: function(element, update, array, options) {
- this.baseInitialize(element, update, options);
- this.options.array = array;
- },
-
- getUpdatedChoices: function() {
- this.updateChoices(this.options.selector(this));
- },
-
- setOptions: function(options) {
- this.options = Object.extend({
- choices: 10,
- partialSearch: true,
- partialChars: 2,
- ignoreCase: true,
- fullSearch: false,
- selector: function(instance) {
- var ret = []; // Beginning matches
- var partial = []; // Inside matches
- var entry = instance.getToken();
- var count = 0;
-
- for (var i = 0; i < instance.options.array.length &&
- ret.length < instance.options.choices ; i++) {
-
- var elem = instance.options.array[i];
- var foundPos = instance.options.ignoreCase ?
- elem.toLowerCase().indexOf(entry.toLowerCase()) :
- elem.indexOf(entry);
-
- while (foundPos != -1) {
- if (foundPos == 0 && elem.length != entry.length) {
- ret.push("" + elem.substr(0, entry.length) + "" +
- elem.substr(entry.length) + "");
- break;
- } else if (entry.length >= instance.options.partialChars &&
- instance.options.partialSearch && foundPos != -1) {
- if (instance.options.fullSearch || /\s/.test(elem.substr(foundPos-1,1))) {
- partial.push("" + elem.substr(0, foundPos) + "" +
- elem.substr(foundPos, entry.length) + "" + elem.substr(
- foundPos + entry.length) + "");
- break;
- }
- }
-
- foundPos = instance.options.ignoreCase ?
- elem.toLowerCase().indexOf(entry.toLowerCase(), foundPos + 1) :
- elem.indexOf(entry, foundPos + 1);
-
- }
- }
- if (partial.length)
- ret = ret.concat(partial.slice(0, instance.options.choices - ret.length))
- return "";
- }
- }, options || {});
- }
-});
-
-// AJAX in-place editor
-//
-// see documentation on http://wiki.script.aculo.us/scriptaculous/show/Ajax.InPlaceEditor
-
-// Use this if you notice weird scrolling problems on some browsers,
-// the DOM might be a bit confused when this gets called so do this
-// waits 1 ms (with setTimeout) until it does the activation
-Field.scrollFreeActivate = function(field) {
- setTimeout(function() {
- Field.activate(field);
- }, 1);
-}
-
-Ajax.InPlaceEditor = Class.create();
-Ajax.InPlaceEditor.defaultHighlightColor = "#FFFF99";
-Ajax.InPlaceEditor.prototype = {
- initialize: function(element, url, options) {
- this.url = url;
- this.element = $(element);
-
- this.options = Object.extend({
- okButton: true,
- okText: "ok",
- cancelLink: true,
- cancelText: "cancel",
- savingText: "Saving...",
- clickToEditText: "Click to edit",
- okText: "ok",
- rows: 1,
- onComplete: function(transport, element) {
- new Effect.Highlight(element, {startcolor: this.options.highlightcolor});
- },
- onFailure: function(transport) {
- alert("Error communicating with the server: " + transport.responseText.stripTags());
- },
- callback: function(form) {
- return Form.serialize(form);
- },
- handleLineBreaks: true,
- loadingText: 'Loading...',
- savingClassName: 'inplaceeditor-saving',
- loadingClassName: 'inplaceeditor-loading',
- formClassName: 'inplaceeditor-form',
- highlightcolor: Ajax.InPlaceEditor.defaultHighlightColor,
- highlightendcolor: "#FFFFFF",
- externalControl: null,
- submitOnBlur: false,
- ajaxOptions: {},
- evalScripts: false
- }, options || {});
-
- if(!this.options.formId && this.element.id) {
- this.options.formId = this.element.id + "-inplaceeditor";
- if ($(this.options.formId)) {
- // there's already a form with that name, don't specify an id
- this.options.formId = null;
- }
- }
-
- if (this.options.externalControl) {
- this.options.externalControl = $(this.options.externalControl);
- }
-
- this.originalBackground = Element.getStyle(this.element, 'background-color');
- if (!this.originalBackground) {
- this.originalBackground = "transparent";
- }
-
- this.element.title = this.options.clickToEditText;
-
- this.onclickListener = this.enterEditMode.bindAsEventListener(this);
- this.mouseoverListener = this.enterHover.bindAsEventListener(this);
- this.mouseoutListener = this.leaveHover.bindAsEventListener(this);
- Event.observe(this.element, 'click', this.onclickListener);
- Event.observe(this.element, 'mouseover', this.mouseoverListener);
- Event.observe(this.element, 'mouseout', this.mouseoutListener);
- if (this.options.externalControl) {
- Event.observe(this.options.externalControl, 'click', this.onclickListener);
- Event.observe(this.options.externalControl, 'mouseover', this.mouseoverListener);
- Event.observe(this.options.externalControl, 'mouseout', this.mouseoutListener);
- }
- },
- enterEditMode: function(evt) {
- if (this.saving) return;
- if (this.editing) return;
- this.editing = true;
- this.onEnterEditMode();
- if (this.options.externalControl) {
- Element.hide(this.options.externalControl);
- }
- Element.hide(this.element);
- this.createForm();
- this.element.parentNode.insertBefore(this.form, this.element);
- Field.scrollFreeActivate(this.editField);
- // stop the event to avoid a page refresh in Safari
- if (evt) {
- Event.stop(evt);
- }
- return false;
- },
- createForm: function() {
- this.form = document.createElement("form");
- this.form.id = this.options.formId;
- Element.addClassName(this.form, this.options.formClassName)
- this.form.onsubmit = this.onSubmit.bind(this);
-
- this.createEditField();
-
- if (this.options.textarea) {
- var br = document.createElement("br");
- this.form.appendChild(br);
- }
-
- if (this.options.okButton) {
- okButton = document.createElement("input");
- okButton.type = "submit";
- okButton.value = this.options.okText;
- okButton.className = 'editor_ok_button';
- this.form.appendChild(okButton);
- }
-
- if (this.options.cancelLink) {
- cancelLink = document.createElement("a");
- cancelLink.href = "#";
- cancelLink.appendChild(document.createTextNode(this.options.cancelText));
- cancelLink.onclick = this.onclickCancel.bind(this);
- cancelLink.className = 'editor_cancel';
- this.form.appendChild(cancelLink);
- }
- },
- hasHTMLLineBreaks: function(string) {
- if (!this.options.handleLineBreaks) return false;
- return string.match(/
/i);
- },
- convertHTMLLineBreaks: function(string) {
- return string.replace(/
/gi, "\n").replace(/
/gi, "\n").replace(/<\/p>/gi, "\n").replace(//gi, "");
- },
- createEditField: function() {
- var text;
- if(this.options.loadTextURL) {
- text = this.options.loadingText;
- } else {
- text = this.getText();
- }
-
- var obj = this;
-
- if (this.options.rows == 1 && !this.hasHTMLLineBreaks(text)) {
- this.options.textarea = false;
- var textField = document.createElement("input");
- textField.obj = this;
- textField.type = "text";
- textField.name = "value";
- textField.value = text;
- textField.style.backgroundColor = this.options.highlightcolor;
- textField.className = 'editor_field';
- var size = this.options.size || this.options.cols || 0;
- if (size != 0) textField.size = size;
- if (this.options.submitOnBlur)
- textField.onblur = this.onSubmit.bind(this);
- this.editField = textField;
- } else {
- this.options.textarea = true;
- var textArea = document.createElement("textarea");
- textArea.obj = this;
- textArea.name = "value";
- textArea.value = this.convertHTMLLineBreaks(text);
- textArea.rows = this.options.rows;
- textArea.cols = this.options.cols || 40;
- textArea.className = 'editor_field';
- if (this.options.submitOnBlur)
- textArea.onblur = this.onSubmit.bind(this);
- this.editField = textArea;
- }
-
- if(this.options.loadTextURL) {
- this.loadExternalText();
- }
- this.form.appendChild(this.editField);
- },
- getText: function() {
- return this.element.innerHTML;
- },
- loadExternalText: function() {
- Element.addClassName(this.form, this.options.loadingClassName);
- this.editField.disabled = true;
- new Ajax.Request(
- this.options.loadTextURL,
- Object.extend({
- asynchronous: true,
- onComplete: this.onLoadedExternalText.bind(this)
- }, this.options.ajaxOptions)
- );
- },
- onLoadedExternalText: function(transport) {
- Element.removeClassName(this.form, this.options.loadingClassName);
- this.editField.disabled = false;
- this.editField.value = transport.responseText.stripTags();
- },
- onclickCancel: function() {
- this.onComplete();
- this.leaveEditMode();
- return false;
- },
- onFailure: function(transport) {
- this.options.onFailure(transport);
- if (this.oldInnerHTML) {
- this.element.innerHTML = this.oldInnerHTML;
- this.oldInnerHTML = null;
- }
- return false;
- },
- onSubmit: function() {
- // onLoading resets these so we need to save them away for the Ajax call
- var form = this.form;
- var value = this.editField.value;
-
- // do this first, sometimes the ajax call returns before we get a chance to switch on Saving...
- // which means this will actually switch on Saving... *after* we've left edit mode causing Saving...
- // to be displayed indefinitely
- this.onLoading();
-
- if (this.options.evalScripts) {
- new Ajax.Request(
- this.url, Object.extend({
- parameters: this.options.callback(form, value),
- onComplete: this.onComplete.bind(this),
- onFailure: this.onFailure.bind(this),
- asynchronous:true,
- evalScripts:true
- }, this.options.ajaxOptions));
- } else {
- new Ajax.Updater(
- { success: this.element,
- // don't update on failure (this could be an option)
- failure: null },
- this.url, Object.extend({
- parameters: this.options.callback(form, value),
- onComplete: this.onComplete.bind(this),
- onFailure: this.onFailure.bind(this)
- }, this.options.ajaxOptions));
- }
- // stop the event to avoid a page refresh in Safari
- if (arguments.length > 1) {
- Event.stop(arguments[0]);
- }
- return false;
- },
- onLoading: function() {
- this.saving = true;
- this.removeForm();
- this.leaveHover();
- this.showSaving();
- },
- showSaving: function() {
- this.oldInnerHTML = this.element.innerHTML;
- this.element.innerHTML = this.options.savingText;
- Element.addClassName(this.element, this.options.savingClassName);
- this.element.style.backgroundColor = this.originalBackground;
- Element.show(this.element);
- },
- removeForm: function() {
- if(this.form) {
- if (this.form.parentNode) Element.remove(this.form);
- this.form = null;
- }
- },
- enterHover: function() {
- if (this.saving) return;
- this.element.style.backgroundColor = this.options.highlightcolor;
- if (this.effect) {
- this.effect.cancel();
- }
- Element.addClassName(this.element, this.options.hoverClassName)
- },
- leaveHover: function() {
- if (this.options.backgroundColor) {
- this.element.style.backgroundColor = this.oldBackground;
- }
- Element.removeClassName(this.element, this.options.hoverClassName)
- if (this.saving) return;
- this.effect = new Effect.Highlight(this.element, {
- startcolor: this.options.highlightcolor,
- endcolor: this.options.highlightendcolor,
- restorecolor: this.originalBackground
- });
- },
- leaveEditMode: function() {
- Element.removeClassName(this.element, this.options.savingClassName);
- this.removeForm();
- this.leaveHover();
- this.element.style.backgroundColor = this.originalBackground;
- Element.show(this.element);
- if (this.options.externalControl) {
- Element.show(this.options.externalControl);
- }
- this.editing = false;
- this.saving = false;
- this.oldInnerHTML = null;
- this.onLeaveEditMode();
- },
- onComplete: function(transport) {
- this.leaveEditMode();
- this.options.onComplete.bind(this)(transport, this.element);
- },
- onEnterEditMode: function() {},
- onLeaveEditMode: function() {},
- dispose: function() {
- if (this.oldInnerHTML) {
- this.element.innerHTML = this.oldInnerHTML;
- }
- this.leaveEditMode();
- Event.stopObserving(this.element, 'click', this.onclickListener);
- Event.stopObserving(this.element, 'mouseover', this.mouseoverListener);
- Event.stopObserving(this.element, 'mouseout', this.mouseoutListener);
- if (this.options.externalControl) {
- Event.stopObserving(this.options.externalControl, 'click', this.onclickListener);
- Event.stopObserving(this.options.externalControl, 'mouseover', this.mouseoverListener);
- Event.stopObserving(this.options.externalControl, 'mouseout', this.mouseoutListener);
- }
- }
-};
-
-Ajax.InPlaceCollectionEditor = Class.create();
-Object.extend(Ajax.InPlaceCollectionEditor.prototype, Ajax.InPlaceEditor.prototype);
-Object.extend(Ajax.InPlaceCollectionEditor.prototype, {
- createEditField: function() {
- if (!this.cached_selectTag) {
- var selectTag = document.createElement("select");
- var collection = this.options.collection || [];
- var optionTag;
- collection.each(function(e,i) {
- optionTag = document.createElement("option");
- optionTag.value = (e instanceof Array) ? e[0] : e;
- if(this.options.value==optionTag.value) optionTag.selected = true;
- optionTag.appendChild(document.createTextNode((e instanceof Array) ? e[1] : e));
- selectTag.appendChild(optionTag);
- }.bind(this));
- this.cached_selectTag = selectTag;
- }
-
- this.editField = this.cached_selectTag;
- if(this.options.loadTextURL) this.loadExternalText();
- this.form.appendChild(this.editField);
- this.options.callback = function(form, value) {
- return "value=" + encodeURIComponent(value);
- }
- }
-});
-
-// Delayed observer, like Form.Element.Observer,
-// but waits for delay after last key input
-// Ideal for live-search fields
-
-Form.Element.DelayedObserver = Class.create();
-Form.Element.DelayedObserver.prototype = {
- initialize: function(element, delay, callback) {
- this.delay = delay || 0.5;
- this.element = $(element);
- this.callback = callback;
- this.timer = null;
- this.lastValue = $F(this.element);
- Event.observe(this.element,'keyup',this.delayedListener.bindAsEventListener(this));
- },
- delayedListener: function(event) {
- if(this.lastValue == $F(this.element)) return;
- if(this.timer) clearTimeout(this.timer);
- this.timer = setTimeout(this.onTimerEvent.bind(this), this.delay * 1000);
- this.lastValue = $F(this.element);
- },
- onTimerEvent: function() {
- this.timer = null;
- this.callback(this.element, $F(this.element));
- }
-};
diff --git a/vendor/plugins/selenium-on-rails/selenium-core/lib/scriptaculous/dragdrop.js b/vendor/plugins/selenium-on-rails/selenium-core/lib/scriptaculous/dragdrop.js
deleted file mode 100644
index be2a30f5..00000000
--- a/vendor/plugins/selenium-on-rails/selenium-core/lib/scriptaculous/dragdrop.js
+++ /dev/null
@@ -1,915 +0,0 @@
-// Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
-// (c) 2005 Sammi Williams (http://www.oriontransfer.co.nz, sammi@oriontransfer.co.nz)
-//
-// See scriptaculous.js for full license.
-
-/*--------------------------------------------------------------------------*/
-
-var Droppables = {
- drops: [],
-
- remove: function(element) {
- this.drops = this.drops.reject(function(d) { return d.element==$(element) });
- },
-
- add: function(element) {
- element = $(element);
- var options = Object.extend({
- greedy: true,
- hoverclass: null,
- tree: false
- }, arguments[1] || {});
-
- // cache containers
- if(options.containment) {
- options._containers = [];
- var containment = options.containment;
- if((typeof containment == 'object') &&
- (containment.constructor == Array)) {
- containment.each( function(c) { options._containers.push($(c)) });
- } else {
- options._containers.push($(containment));
- }
- }
-
- if(options.accept) options.accept = [options.accept].flatten();
-
- Element.makePositioned(element); // fix IE
- options.element = element;
-
- this.drops.push(options);
- },
-
- findDeepestChild: function(drops) {
- deepest = drops[0];
-
- for (i = 1; i < drops.length; ++i)
- if (Element.isParent(drops[i].element, deepest.element))
- deepest = drops[i];
-
- return deepest;
- },
-
- isContained: function(element, drop) {
- var containmentNode;
- if(drop.tree) {
- containmentNode = element.treeNode;
- } else {
- containmentNode = element.parentNode;
- }
- return drop._containers.detect(function(c) { return containmentNode == c });
- },
-
- isAffected: function(point, element, drop) {
- return (
- (drop.element!=element) &&
- ((!drop._containers) ||
- this.isContained(element, drop)) &&
- ((!drop.accept) ||
- (Element.classNames(element).detect(
- function(v) { return drop.accept.include(v) } ) )) &&
- Position.within(drop.element, point[0], point[1]) );
- },
-
- deactivate: function(drop) {
- if(drop.hoverclass)
- Element.removeClassName(drop.element, drop.hoverclass);
- this.last_active = null;
- },
-
- activate: function(drop) {
- if(drop.hoverclass)
- Element.addClassName(drop.element, drop.hoverclass);
- this.last_active = drop;
- },
-
- show: function(point, element) {
- if(!this.drops.length) return;
- var affected = [];
-
- if(this.last_active) this.deactivate(this.last_active);
- this.drops.each( function(drop) {
- if(Droppables.isAffected(point, element, drop))
- affected.push(drop);
- });
-
- if(affected.length>0) {
- drop = Droppables.findDeepestChild(affected);
- Position.within(drop.element, point[0], point[1]);
- if(drop.onHover)
- drop.onHover(element, drop.element, Position.overlap(drop.overlap, drop.element));
-
- Droppables.activate(drop);
- }
- },
-
- fire: function(event, element) {
- if(!this.last_active) return;
- Position.prepare();
-
- if (this.isAffected([Event.pointerX(event), Event.pointerY(event)], element, this.last_active))
- if (this.last_active.onDrop)
- this.last_active.onDrop(element, this.last_active.element, event);
- },
-
- reset: function() {
- if(this.last_active)
- this.deactivate(this.last_active);
- }
-}
-
-var Draggables = {
- drags: [],
- observers: [],
-
- register: function(draggable) {
- if(this.drags.length == 0) {
- this.eventMouseUp = this.endDrag.bindAsEventListener(this);
- this.eventMouseMove = this.updateDrag.bindAsEventListener(this);
- this.eventKeypress = this.keyPress.bindAsEventListener(this);
-
- Event.observe(document, "mouseup", this.eventMouseUp);
- Event.observe(document, "mousemove", this.eventMouseMove);
- Event.observe(document, "keypress", this.eventKeypress);
- }
- this.drags.push(draggable);
- },
-
- unregister: function(draggable) {
- this.drags = this.drags.reject(function(d) { return d==draggable });
- if(this.drags.length == 0) {
- Event.stopObserving(document, "mouseup", this.eventMouseUp);
- Event.stopObserving(document, "mousemove", this.eventMouseMove);
- Event.stopObserving(document, "keypress", this.eventKeypress);
- }
- },
-
- activate: function(draggable) {
- window.focus(); // allows keypress events if window isn't currently focused, fails for Safari
- this.activeDraggable = draggable;
- },
-
- deactivate: function() {
- this.activeDraggable = null;
- },
-
- updateDrag: function(event) {
- if(!this.activeDraggable) return;
- var pointer = [Event.pointerX(event), Event.pointerY(event)];
- // Mozilla-based browsers fire successive mousemove events with
- // the same coordinates, prevent needless redrawing (moz bug?)
- if(this._lastPointer && (this._lastPointer.inspect() == pointer.inspect())) return;
- this._lastPointer = pointer;
- this.activeDraggable.updateDrag(event, pointer);
- },
-
- endDrag: function(event) {
- if(!this.activeDraggable) return;
- this._lastPointer = null;
- this.activeDraggable.endDrag(event);
- this.activeDraggable = null;
- },
-
- keyPress: function(event) {
- if(this.activeDraggable)
- this.activeDraggable.keyPress(event);
- },
-
- addObserver: function(observer) {
- this.observers.push(observer);
- this._cacheObserverCallbacks();
- },
-
- removeObserver: function(element) { // element instead of observer fixes mem leaks
- this.observers = this.observers.reject( function(o) { return o.element==element });
- this._cacheObserverCallbacks();
- },
-
- notify: function(eventName, draggable, event) { // 'onStart', 'onEnd', 'onDrag'
- if(this[eventName+'Count'] > 0)
- this.observers.each( function(o) {
- if(o[eventName]) o[eventName](eventName, draggable, event);
- });
- },
-
- _cacheObserverCallbacks: function() {
- ['onStart','onEnd','onDrag'].each( function(eventName) {
- Draggables[eventName+'Count'] = Draggables.observers.select(
- function(o) { return o[eventName]; }
- ).length;
- });
- }
-}
-
-/*--------------------------------------------------------------------------*/
-
-var Draggable = Class.create();
-Draggable.prototype = {
- initialize: function(element) {
- var options = Object.extend({
- handle: false,
- starteffect: function(element) {
- element._opacity = Element.getOpacity(element);
- new Effect.Opacity(element, {duration:0.2, from:element._opacity, to:0.7});
- },
- reverteffect: function(element, top_offset, left_offset) {
- var dur = Math.sqrt(Math.abs(top_offset^2)+Math.abs(left_offset^2))*0.02;
- element._revert = new Effect.Move(element, { x: -left_offset, y: -top_offset, duration: dur});
- },
- endeffect: function(element) {
- var toOpacity = typeof element._opacity == 'number' ? element._opacity : 1.0
- new Effect.Opacity(element, {duration:0.2, from:0.7, to:toOpacity});
- },
- zindex: 1000,
- revert: false,
- scroll: false,
- scrollSensitivity: 20,
- scrollSpeed: 15,
- snap: false // false, or xy or [x,y] or function(x,y){ return [x,y] }
- }, arguments[1] || {});
-
- this.element = $(element);
-
- if(options.handle && (typeof options.handle == 'string')) {
- var h = Element.childrenWithClassName(this.element, options.handle, true);
- if(h.length>0) this.handle = h[0];
- }
- if(!this.handle) this.handle = $(options.handle);
- if(!this.handle) this.handle = this.element;
-
- if(options.scroll && !options.scroll.scrollTo && !options.scroll.outerHTML)
- options.scroll = $(options.scroll);
-
- Element.makePositioned(this.element); // fix IE
-
- this.delta = this.currentDelta();
- this.options = options;
- this.dragging = false;
-
- this.eventMouseDown = this.initDrag.bindAsEventListener(this);
- Event.observe(this.handle, "mousedown", this.eventMouseDown);
-
- Draggables.register(this);
- },
-
- destroy: function() {
- Event.stopObserving(this.handle, "mousedown", this.eventMouseDown);
- Draggables.unregister(this);
- },
-
- currentDelta: function() {
- return([
- parseInt(Element.getStyle(this.element,'left') || '0'),
- parseInt(Element.getStyle(this.element,'top') || '0')]);
- },
-
- initDrag: function(event) {
- if(Event.isLeftClick(event)) {
- // abort on form elements, fixes a Firefox issue
- var src = Event.element(event);
- if(src.tagName && (
- src.tagName=='INPUT' ||
- src.tagName=='SELECT' ||
- src.tagName=='OPTION' ||
- src.tagName=='BUTTON' ||
- src.tagName=='TEXTAREA')) return;
-
- if(this.element._revert) {
- this.element._revert.cancel();
- this.element._revert = null;
- }
-
- var pointer = [Event.pointerX(event), Event.pointerY(event)];
- var pos = Position.cumulativeOffset(this.element);
- this.offset = [0,1].map( function(i) { return (pointer[i] - pos[i]) });
-
- Draggables.activate(this);
- Event.stop(event);
- }
- },
-
- startDrag: function(event) {
- this.dragging = true;
-
- if(this.options.zindex) {
- this.originalZ = parseInt(Element.getStyle(this.element,'z-index') || 0);
- this.element.style.zIndex = this.options.zindex;
- }
-
- if(this.options.ghosting) {
- this._clone = this.element.cloneNode(true);
- Position.absolutize(this.element);
- this.element.parentNode.insertBefore(this._clone, this.element);
- }
-
- if(this.options.scroll) {
- if (this.options.scroll == window) {
- var where = this._getWindowScroll(this.options.scroll);
- this.originalScrollLeft = where.left;
- this.originalScrollTop = where.top;
- } else {
- this.originalScrollLeft = this.options.scroll.scrollLeft;
- this.originalScrollTop = this.options.scroll.scrollTop;
- }
- }
-
- Draggables.notify('onStart', this, event);
- if(this.options.starteffect) this.options.starteffect(this.element);
- },
-
- updateDrag: function(event, pointer) {
- if(!this.dragging) this.startDrag(event);
- Position.prepare();
- Droppables.show(pointer, this.element);
- Draggables.notify('onDrag', this, event);
- this.draw(pointer);
- if(this.options.change) this.options.change(this);
-
- if(this.options.scroll) {
- this.stopScrolling();
-
- var p;
- if (this.options.scroll == window) {
- with(this._getWindowScroll(this.options.scroll)) { p = [ left, top, left+width, top+height ]; }
- } else {
- p = Position.page(this.options.scroll);
- p[0] += this.options.scroll.scrollLeft;
- p[1] += this.options.scroll.scrollTop;
- p.push(p[0]+this.options.scroll.offsetWidth);
- p.push(p[1]+this.options.scroll.offsetHeight);
- }
- var speed = [0,0];
- if(pointer[0] < (p[0]+this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[0]+this.options.scrollSensitivity);
- if(pointer[1] < (p[1]+this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[1]+this.options.scrollSensitivity);
- if(pointer[0] > (p[2]-this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[2]-this.options.scrollSensitivity);
- if(pointer[1] > (p[3]-this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[3]-this.options.scrollSensitivity);
- this.startScrolling(speed);
- }
-
- // fix AppleWebKit rendering
- if(navigator.appVersion.indexOf('AppleWebKit')>0) window.scrollBy(0,0);
-
- Event.stop(event);
- },
-
- finishDrag: function(event, success) {
- this.dragging = false;
-
- if(this.options.ghosting) {
- Position.relativize(this.element);
- Element.remove(this._clone);
- this._clone = null;
- }
-
- if(success) Droppables.fire(event, this.element);
- Draggables.notify('onEnd', this, event);
-
- var revert = this.options.revert;
- if(revert && typeof revert == 'function') revert = revert(this.element);
-
- var d = this.currentDelta();
- if(revert && this.options.reverteffect) {
- this.options.reverteffect(this.element,
- d[1]-this.delta[1], d[0]-this.delta[0]);
- } else {
- this.delta = d;
- }
-
- if(this.options.zindex)
- this.element.style.zIndex = this.originalZ;
-
- if(this.options.endeffect)
- this.options.endeffect(this.element);
-
- Draggables.deactivate(this);
- Droppables.reset();
- },
-
- keyPress: function(event) {
- if(event.keyCode!=Event.KEY_ESC) return;
- this.finishDrag(event, false);
- Event.stop(event);
- },
-
- endDrag: function(event) {
- if(!this.dragging) return;
- this.stopScrolling();
- this.finishDrag(event, true);
- Event.stop(event);
- },
-
- draw: function(point) {
- var pos = Position.cumulativeOffset(this.element);
- var d = this.currentDelta();
- pos[0] -= d[0]; pos[1] -= d[1];
-
- if(this.options.scroll && (this.options.scroll != window)) {
- pos[0] -= this.options.scroll.scrollLeft-this.originalScrollLeft;
- pos[1] -= this.options.scroll.scrollTop-this.originalScrollTop;
- }
-
- var p = [0,1].map(function(i){
- return (point[i]-pos[i]-this.offset[i])
- }.bind(this));
-
- if(this.options.snap) {
- if(typeof this.options.snap == 'function') {
- p = this.options.snap(p[0],p[1],this);
- } else {
- if(this.options.snap instanceof Array) {
- p = p.map( function(v, i) {
- return Math.round(v/this.options.snap[i])*this.options.snap[i] }.bind(this))
- } else {
- p = p.map( function(v) {
- return Math.round(v/this.options.snap)*this.options.snap }.bind(this))
- }
- }}
-
- var style = this.element.style;
- if((!this.options.constraint) || (this.options.constraint=='horizontal'))
- style.left = p[0] + "px";
- if((!this.options.constraint) || (this.options.constraint=='vertical'))
- style.top = p[1] + "px";
- if(style.visibility=="hidden") style.visibility = ""; // fix gecko rendering
- },
-
- stopScrolling: function() {
- if(this.scrollInterval) {
- clearInterval(this.scrollInterval);
- this.scrollInterval = null;
- Draggables._lastScrollPointer = null;
- }
- },
-
- startScrolling: function(speed) {
- this.scrollSpeed = [speed[0]*this.options.scrollSpeed,speed[1]*this.options.scrollSpeed];
- this.lastScrolled = new Date();
- this.scrollInterval = setInterval(this.scroll.bind(this), 10);
- },
-
- scroll: function() {
- var current = new Date();
- var delta = current - this.lastScrolled;
- this.lastScrolled = current;
- if(this.options.scroll == window) {
- with (this._getWindowScroll(this.options.scroll)) {
- if (this.scrollSpeed[0] || this.scrollSpeed[1]) {
- var d = delta / 1000;
- this.options.scroll.scrollTo( left + d*this.scrollSpeed[0], top + d*this.scrollSpeed[1] );
- }
- }
- } else {
- this.options.scroll.scrollLeft += this.scrollSpeed[0] * delta / 1000;
- this.options.scroll.scrollTop += this.scrollSpeed[1] * delta / 1000;
- }
-
- Position.prepare();
- Droppables.show(Draggables._lastPointer, this.element);
- Draggables.notify('onDrag', this);
- Draggables._lastScrollPointer = Draggables._lastScrollPointer || $A(Draggables._lastPointer);
- Draggables._lastScrollPointer[0] += this.scrollSpeed[0] * delta / 1000;
- Draggables._lastScrollPointer[1] += this.scrollSpeed[1] * delta / 1000;
- if (Draggables._lastScrollPointer[0] < 0)
- Draggables._lastScrollPointer[0] = 0;
- if (Draggables._lastScrollPointer[1] < 0)
- Draggables._lastScrollPointer[1] = 0;
- this.draw(Draggables._lastScrollPointer);
-
- if(this.options.change) this.options.change(this);
- },
-
- _getWindowScroll: function(w) {
- var T, L, W, H;
- with (w.document) {
- if (w.document.documentElement && documentElement.scrollTop) {
- T = documentElement.scrollTop;
- L = documentElement.scrollLeft;
- } else if (w.document.body) {
- T = body.scrollTop;
- L = body.scrollLeft;
- }
- if (w.innerWidth) {
- W = w.innerWidth;
- H = w.innerHeight;
- } else if (w.document.documentElement && documentElement.clientWidth) {
- W = documentElement.clientWidth;
- H = documentElement.clientHeight;
- } else {
- W = body.offsetWidth;
- H = body.offsetHeight
- }
- }
- return { top: T, left: L, width: W, height: H };
- }
-}
-
-/*--------------------------------------------------------------------------*/
-
-var SortableObserver = Class.create();
-SortableObserver.prototype = {
- initialize: function(element, observer) {
- this.element = $(element);
- this.observer = observer;
- this.lastValue = Sortable.serialize(this.element);
- },
-
- onStart: function() {
- this.lastValue = Sortable.serialize(this.element);
- },
-
- onEnd: function() {
- Sortable.unmark();
- if(this.lastValue != Sortable.serialize(this.element))
- this.observer(this.element)
- }
-}
-
-var Sortable = {
- sortables: {},
-
- _findRootElement: function(element) {
- while (element.tagName != "BODY") {
- if(element.id && Sortable.sortables[element.id]) return element;
- element = element.parentNode;
- }
- },
-
- options: function(element) {
- element = Sortable._findRootElement($(element));
- if(!element) return;
- return Sortable.sortables[element.id];
- },
-
- destroy: function(element){
- var s = Sortable.options(element);
-
- if(s) {
- Draggables.removeObserver(s.element);
- s.droppables.each(function(d){ Droppables.remove(d) });
- s.draggables.invoke('destroy');
-
- delete Sortable.sortables[s.element.id];
- }
- },
-
- create: function(element) {
- element = $(element);
- var options = Object.extend({
- element: element,
- tag: 'li', // assumes li children, override with tag: 'tagname'
- dropOnEmpty: false,
- tree: false,
- treeTag: 'ul',
- overlap: 'vertical', // one of 'vertical', 'horizontal'
- constraint: 'vertical', // one of 'vertical', 'horizontal', false
- containment: element, // also takes array of elements (or id's); or false
- handle: false, // or a CSS class
- only: false,
- hoverclass: null,
- ghosting: false,
- scroll: false,
- scrollSensitivity: 20,
- scrollSpeed: 15,
- format: /^[^_]*_(.*)$/,
- onChange: Prototype.emptyFunction,
- onUpdate: Prototype.emptyFunction
- }, arguments[1] || {});
-
- // clear any old sortable with same element
- this.destroy(element);
-
- // build options for the draggables
- var options_for_draggable = {
- revert: true,
- scroll: options.scroll,
- scrollSpeed: options.scrollSpeed,
- scrollSensitivity: options.scrollSensitivity,
- ghosting: options.ghosting,
- constraint: options.constraint,
- handle: options.handle };
-
- if(options.starteffect)
- options_for_draggable.starteffect = options.starteffect;
-
- if(options.reverteffect)
- options_for_draggable.reverteffect = options.reverteffect;
- else
- if(options.ghosting) options_for_draggable.reverteffect = function(element) {
- element.style.top = 0;
- element.style.left = 0;
- };
-
- if(options.endeffect)
- options_for_draggable.endeffect = options.endeffect;
-
- if(options.zindex)
- options_for_draggable.zindex = options.zindex;
-
- // build options for the droppables
- var options_for_droppable = {
- overlap: options.overlap,
- containment: options.containment,
- tree: options.tree,
- hoverclass: options.hoverclass,
- onHover: Sortable.onHover
- //greedy: !options.dropOnEmpty
- }
-
- var options_for_tree = {
- onHover: Sortable.onEmptyHover,
- overlap: options.overlap,
- containment: options.containment,
- hoverclass: options.hoverclass
- }
-
- // fix for gecko engine
- Element.cleanWhitespace(element);
-
- options.draggables = [];
- options.droppables = [];
-
- // drop on empty handling
- if(options.dropOnEmpty || options.tree) {
- Droppables.add(element, options_for_tree);
- options.droppables.push(element);
- }
-
- (this.findElements(element, options) || []).each( function(e) {
- // handles are per-draggable
- var handle = options.handle ?
- Element.childrenWithClassName(e, options.handle)[0] : e;
- options.draggables.push(
- new Draggable(e, Object.extend(options_for_draggable, { handle: handle })));
- Droppables.add(e, options_for_droppable);
- if(options.tree) e.treeNode = element;
- options.droppables.push(e);
- });
-
- if(options.tree) {
- (Sortable.findTreeElements(element, options) || []).each( function(e) {
- Droppables.add(e, options_for_tree);
- e.treeNode = element;
- options.droppables.push(e);
- });
- }
-
- // keep reference
- this.sortables[element.id] = options;
-
- // for onupdate
- Draggables.addObserver(new SortableObserver(element, options.onUpdate));
-
- },
-
- // return all suitable-for-sortable elements in a guaranteed order
- findElements: function(element, options) {
- return Element.findChildren(
- element, options.only, options.tree ? true : false, options.tag);
- },
-
- findTreeElements: function(element, options) {
- return Element.findChildren(
- element, options.only, options.tree ? true : false, options.treeTag);
- },
-
- onHover: function(element, dropon, overlap) {
- if(Element.isParent(dropon, element)) return;
-
- if(overlap > .33 && overlap < .66 && Sortable.options(dropon).tree) {
- return;
- } else if(overlap>0.5) {
- Sortable.mark(dropon, 'before');
- if(dropon.previousSibling != element) {
- var oldParentNode = element.parentNode;
- element.style.visibility = "hidden"; // fix gecko rendering
- dropon.parentNode.insertBefore(element, dropon);
- if(dropon.parentNode!=oldParentNode)
- Sortable.options(oldParentNode).onChange(element);
- Sortable.options(dropon.parentNode).onChange(element);
- }
- } else {
- Sortable.mark(dropon, 'after');
- var nextElement = dropon.nextSibling || null;
- if(nextElement != element) {
- var oldParentNode = element.parentNode;
- element.style.visibility = "hidden"; // fix gecko rendering
- dropon.parentNode.insertBefore(element, nextElement);
- if(dropon.parentNode!=oldParentNode)
- Sortable.options(oldParentNode).onChange(element);
- Sortable.options(dropon.parentNode).onChange(element);
- }
- }
- },
-
- onEmptyHover: function(element, dropon, overlap) {
- var oldParentNode = element.parentNode;
- var droponOptions = Sortable.options(dropon);
-
- if(!Element.isParent(dropon, element)) {
- var index;
-
- var children = Sortable.findElements(dropon, {tag: droponOptions.tag});
- var child = null;
-
- if(children) {
- var offset = Element.offsetSize(dropon, droponOptions.overlap) * (1.0 - overlap);
-
- for (index = 0; index < children.length; index += 1) {
- if (offset - Element.offsetSize (children[index], droponOptions.overlap) >= 0) {
- offset -= Element.offsetSize (children[index], droponOptions.overlap);
- } else if (offset - (Element.offsetSize (children[index], droponOptions.overlap) / 2) >= 0) {
- child = index + 1 < children.length ? children[index + 1] : null;
- break;
- } else {
- child = children[index];
- break;
- }
- }
- }
-
- dropon.insertBefore(element, child);
-
- Sortable.options(oldParentNode).onChange(element);
- droponOptions.onChange(element);
- }
- },
-
- unmark: function() {
- if(Sortable._marker) Element.hide(Sortable._marker);
- },
-
- mark: function(dropon, position) {
- // mark on ghosting only
- var sortable = Sortable.options(dropon.parentNode);
- if(sortable && !sortable.ghosting) return;
-
- if(!Sortable._marker) {
- Sortable._marker = $('dropmarker') || document.createElement('DIV');
- Element.hide(Sortable._marker);
- Element.addClassName(Sortable._marker, 'dropmarker');
- Sortable._marker.style.position = 'absolute';
- document.getElementsByTagName("body").item(0).appendChild(Sortable._marker);
- }
- var offsets = Position.cumulativeOffset(dropon);
- Sortable._marker.style.left = offsets[0] + 'px';
- Sortable._marker.style.top = offsets[1] + 'px';
-
- if(position=='after')
- if(sortable.overlap == 'horizontal')
- Sortable._marker.style.left = (offsets[0]+dropon.clientWidth) + 'px';
- else
- Sortable._marker.style.top = (offsets[1]+dropon.clientHeight) + 'px';
-
- Element.show(Sortable._marker);
- },
-
- _tree: function(element, options, parent) {
- var children = Sortable.findElements(element, options) || [];
-
- for (var i = 0; i < children.length; ++i) {
- var match = children[i].id.match(options.format);
-
- if (!match) continue;
-
- var child = {
- id: encodeURIComponent(match ? match[1] : null),
- element: element,
- parent: parent,
- children: new Array,
- position: parent.children.length,
- container: Sortable._findChildrenElement(children[i], options.treeTag.toUpperCase())
- }
-
- /* Get the element containing the children and recurse over it */
- if (child.container)
- this._tree(child.container, options, child)
-
- parent.children.push (child);
- }
-
- return parent;
- },
-
- /* Finds the first element of the given tag type within a parent element.
- Used for finding the first LI[ST] within a L[IST]I[TEM].*/
- _findChildrenElement: function (element, containerTag) {
- if (element && element.hasChildNodes)
- for (var i = 0; i < element.childNodes.length; ++i)
- if (element.childNodes[i].tagName == containerTag)
- return element.childNodes[i];
-
- return null;
- },
-
- tree: function(element) {
- element = $(element);
- var sortableOptions = this.options(element);
- var options = Object.extend({
- tag: sortableOptions.tag,
- treeTag: sortableOptions.treeTag,
- only: sortableOptions.only,
- name: element.id,
- format: sortableOptions.format
- }, arguments[1] || {});
-
- var root = {
- id: null,
- parent: null,
- children: new Array,
- container: element,
- position: 0
- }
-
- return Sortable._tree (element, options, root);
- },
-
- /* Construct a [i] index for a particular node */
- _constructIndex: function(node) {
- var index = '';
- do {
- if (node.id) index = '[' + node.position + ']' + index;
- } while ((node = node.parent) != null);
- return index;
- },
-
- sequence: function(element) {
- element = $(element);
- var options = Object.extend(this.options(element), arguments[1] || {});
-
- return $(this.findElements(element, options) || []).map( function(item) {
- return item.id.match(options.format) ? item.id.match(options.format)[1] : '';
- });
- },
-
- setSequence: function(element, new_sequence) {
- element = $(element);
- var options = Object.extend(this.options(element), arguments[2] || {});
-
- var nodeMap = {};
- this.findElements(element, options).each( function(n) {
- if (n.id.match(options.format))
- nodeMap[n.id.match(options.format)[1]] = [n, n.parentNode];
- n.parentNode.removeChild(n);
- });
-
- new_sequence.each(function(ident) {
- var n = nodeMap[ident];
- if (n) {
- n[1].appendChild(n[0]);
- delete nodeMap[ident];
- }
- });
- },
-
- serialize: function(element) {
- element = $(element);
- var options = Object.extend(Sortable.options(element), arguments[1] || {});
- var name = encodeURIComponent(
- (arguments[1] && arguments[1].name) ? arguments[1].name : element.id);
-
- if (options.tree) {
- return Sortable.tree(element, arguments[1]).children.map( function (item) {
- return [name + Sortable._constructIndex(item) + "=" +
- encodeURIComponent(item.id)].concat(item.children.map(arguments.callee));
- }).flatten().join('&');
- } else {
- return Sortable.sequence(element, arguments[1]).map( function(item) {
- return name + "[]=" + encodeURIComponent(item);
- }).join('&');
- }
- }
-}
-
-/* Returns true if child is contained within element */
-Element.isParent = function(child, element) {
- if (!child.parentNode || child == element) return false;
-
- if (child.parentNode == element) return true;
-
- return Element.isParent(child.parentNode, element);
-}
-
-Element.findChildren = function(element, only, recursive, tagName) {
- if(!element.hasChildNodes()) return null;
- tagName = tagName.toUpperCase();
- if(only) only = [only].flatten();
- var elements = [];
- $A(element.childNodes).each( function(e) {
- if(e.tagName && e.tagName.toUpperCase()==tagName &&
- (!only || (Element.classNames(e).detect(function(v) { return only.include(v) }))))
- elements.push(e);
- if(recursive) {
- var grandchildren = Element.findChildren(e, only, recursive, tagName);
- if(grandchildren) elements.push(grandchildren);
- }
- });
-
- return (elements.length>0 ? elements.flatten() : []);
-}
-
-Element.offsetSize = function (element, type) {
- if (type == 'vertical' || type == 'height')
- return element.offsetHeight;
- else
- return element.offsetWidth;
-}
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/selenium-core/lib/scriptaculous/effects.js b/vendor/plugins/selenium-on-rails/selenium-core/lib/scriptaculous/effects.js
deleted file mode 100644
index 0864323e..00000000
--- a/vendor/plugins/selenium-on-rails/selenium-core/lib/scriptaculous/effects.js
+++ /dev/null
@@ -1,958 +0,0 @@
-// Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
-// Contributors:
-// Justin Palmer (http://encytemedia.com/)
-// Mark Pilgrim (http://diveintomark.org/)
-// Martin Bialasinki
-//
-// See scriptaculous.js for full license.
-
-// converts rgb() and #xxx to #xxxxxx format,
-// returns self (or first argument) if not convertable
-String.prototype.parseColor = function() {
- var color = '#';
- if(this.slice(0,4) == 'rgb(') {
- var cols = this.slice(4,this.length-1).split(',');
- var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3);
- } else {
- if(this.slice(0,1) == '#') {
- if(this.length==4) for(var i=1;i<4;i++) color += (this.charAt(i) + this.charAt(i)).toLowerCase();
- if(this.length==7) color = this.toLowerCase();
- }
- }
- return(color.length==7 ? color : (arguments[0] || this));
-}
-
-/*--------------------------------------------------------------------------*/
-
-Element.collectTextNodes = function(element) {
- return $A($(element).childNodes).collect( function(node) {
- return (node.nodeType==3 ? node.nodeValue :
- (node.hasChildNodes() ? Element.collectTextNodes(node) : ''));
- }).flatten().join('');
-}
-
-Element.collectTextNodesIgnoreClass = function(element, className) {
- return $A($(element).childNodes).collect( function(node) {
- return (node.nodeType==3 ? node.nodeValue :
- ((node.hasChildNodes() && !Element.hasClassName(node,className)) ?
- Element.collectTextNodesIgnoreClass(node, className) : ''));
- }).flatten().join('');
-}
-
-Element.setContentZoom = function(element, percent) {
- element = $(element);
- Element.setStyle(element, {fontSize: (percent/100) + 'em'});
- if(navigator.appVersion.indexOf('AppleWebKit')>0) window.scrollBy(0,0);
-}
-
-Element.getOpacity = function(element){
- var opacity;
- if (opacity = Element.getStyle(element, 'opacity'))
- return parseFloat(opacity);
- if (opacity = (Element.getStyle(element, 'filter') || '').match(/alpha\(opacity=(.*)\)/))
- if(opacity[1]) return parseFloat(opacity[1]) / 100;
- return 1.0;
-}
-
-Element.setOpacity = function(element, value){
- element= $(element);
- if (value == 1){
- Element.setStyle(element, { opacity:
- (/Gecko/.test(navigator.userAgent) && !/Konqueror|Safari|KHTML/.test(navigator.userAgent)) ?
- 0.999999 : null });
- if(/MSIE/.test(navigator.userAgent))
- Element.setStyle(element, {filter: Element.getStyle(element,'filter').replace(/alpha\([^\)]*\)/gi,'')});
- } else {
- if(value < 0.00001) value = 0;
- Element.setStyle(element, {opacity: value});
- if(/MSIE/.test(navigator.userAgent))
- Element.setStyle(element,
- { filter: Element.getStyle(element,'filter').replace(/alpha\([^\)]*\)/gi,'') +
- 'alpha(opacity='+value*100+')' });
- }
-}
-
-Element.getInlineOpacity = function(element){
- return $(element).style.opacity || '';
-}
-
-Element.childrenWithClassName = function(element, className, findFirst) {
- var classNameRegExp = new RegExp("(^|\\s)" + className + "(\\s|$)");
- var results = $A($(element).getElementsByTagName('*'))[findFirst ? 'detect' : 'select']( function(c) {
- return (c.className && c.className.match(classNameRegExp));
- });
- if(!results) results = [];
- return results;
-}
-
-Element.forceRerendering = function(element) {
- try {
- element = $(element);
- var n = document.createTextNode(' ');
- element.appendChild(n);
- element.removeChild(n);
- } catch(e) { }
-};
-
-/*--------------------------------------------------------------------------*/
-
-Array.prototype.call = function() {
- var args = arguments;
- this.each(function(f){ f.apply(this, args) });
-}
-
-/*--------------------------------------------------------------------------*/
-
-var Effect = {
- tagifyText: function(element) {
- var tagifyStyle = 'position:relative';
- if(/MSIE/.test(navigator.userAgent)) tagifyStyle += ';zoom:1';
- element = $(element);
- $A(element.childNodes).each( function(child) {
- if(child.nodeType==3) {
- child.nodeValue.toArray().each( function(character) {
- element.insertBefore(
- Builder.node('span',{style: tagifyStyle},
- character == ' ' ? String.fromCharCode(160) : character),
- child);
- });
- Element.remove(child);
- }
- });
- },
- multiple: function(element, effect) {
- var elements;
- if(((typeof element == 'object') ||
- (typeof element == 'function')) &&
- (element.length))
- elements = element;
- else
- elements = $(element).childNodes;
-
- var options = Object.extend({
- speed: 0.1,
- delay: 0.0
- }, arguments[2] || {});
- var masterDelay = options.delay;
-
- $A(elements).each( function(element, index) {
- new effect(element, Object.extend(options, { delay: index * options.speed + masterDelay }));
- });
- },
- PAIRS: {
- 'slide': ['SlideDown','SlideUp'],
- 'blind': ['BlindDown','BlindUp'],
- 'appear': ['Appear','Fade']
- },
- toggle: function(element, effect) {
- element = $(element);
- effect = (effect || 'appear').toLowerCase();
- var options = Object.extend({
- queue: { position:'end', scope:(element.id || 'global'), limit: 1 }
- }, arguments[2] || {});
- Effect[element.visible() ?
- Effect.PAIRS[effect][1] : Effect.PAIRS[effect][0]](element, options);
- }
-};
-
-var Effect2 = Effect; // deprecated
-
-/* ------------- transitions ------------- */
-
-Effect.Transitions = {}
-
-Effect.Transitions.linear = function(pos) {
- return pos;
-}
-Effect.Transitions.sinoidal = function(pos) {
- return (-Math.cos(pos*Math.PI)/2) + 0.5;
-}
-Effect.Transitions.reverse = function(pos) {
- return 1-pos;
-}
-Effect.Transitions.flicker = function(pos) {
- return ((-Math.cos(pos*Math.PI)/4) + 0.75) + Math.random()/4;
-}
-Effect.Transitions.wobble = function(pos) {
- return (-Math.cos(pos*Math.PI*(9*pos))/2) + 0.5;
-}
-Effect.Transitions.pulse = function(pos) {
- return (Math.floor(pos*10) % 2 == 0 ?
- (pos*10-Math.floor(pos*10)) : 1-(pos*10-Math.floor(pos*10)));
-}
-Effect.Transitions.none = function(pos) {
- return 0;
-}
-Effect.Transitions.full = function(pos) {
- return 1;
-}
-
-/* ------------- core effects ------------- */
-
-Effect.ScopedQueue = Class.create();
-Object.extend(Object.extend(Effect.ScopedQueue.prototype, Enumerable), {
- initialize: function() {
- this.effects = [];
- this.interval = null;
- },
- _each: function(iterator) {
- this.effects._each(iterator);
- },
- add: function(effect) {
- var timestamp = new Date().getTime();
-
- var position = (typeof effect.options.queue == 'string') ?
- effect.options.queue : effect.options.queue.position;
-
- switch(position) {
- case 'front':
- // move unstarted effects after this effect
- this.effects.findAll(function(e){ return e.state=='idle' }).each( function(e) {
- e.startOn += effect.finishOn;
- e.finishOn += effect.finishOn;
- });
- break;
- case 'end':
- // start effect after last queued effect has finished
- timestamp = this.effects.pluck('finishOn').max() || timestamp;
- break;
- }
-
- effect.startOn += timestamp;
- effect.finishOn += timestamp;
-
- if(!effect.options.queue.limit || (this.effects.length < effect.options.queue.limit))
- this.effects.push(effect);
-
- if(!this.interval)
- this.interval = setInterval(this.loop.bind(this), 40);
- },
- remove: function(effect) {
- this.effects = this.effects.reject(function(e) { return e==effect });
- if(this.effects.length == 0) {
- clearInterval(this.interval);
- this.interval = null;
- }
- },
- loop: function() {
- var timePos = new Date().getTime();
- this.effects.invoke('loop', timePos);
- }
-});
-
-Effect.Queues = {
- instances: $H(),
- get: function(queueName) {
- if(typeof queueName != 'string') return queueName;
-
- if(!this.instances[queueName])
- this.instances[queueName] = new Effect.ScopedQueue();
-
- return this.instances[queueName];
- }
-}
-Effect.Queue = Effect.Queues.get('global');
-
-Effect.DefaultOptions = {
- transition: Effect.Transitions.sinoidal,
- duration: 1.0, // seconds
- fps: 25.0, // max. 25fps due to Effect.Queue implementation
- sync: false, // true for combining
- from: 0.0,
- to: 1.0,
- delay: 0.0,
- queue: 'parallel'
-}
-
-Effect.Base = function() {};
-Effect.Base.prototype = {
- position: null,
- start: function(options) {
- this.options = Object.extend(Object.extend({},Effect.DefaultOptions), options || {});
- this.currentFrame = 0;
- this.state = 'idle';
- this.startOn = this.options.delay*1000;
- this.finishOn = this.startOn + (this.options.duration*1000);
- this.event('beforeStart');
- if(!this.options.sync)
- Effect.Queues.get(typeof this.options.queue == 'string' ?
- 'global' : this.options.queue.scope).add(this);
- },
- loop: function(timePos) {
- if(timePos >= this.startOn) {
- if(timePos >= this.finishOn) {
- this.render(1.0);
- this.cancel();
- this.event('beforeFinish');
- if(this.finish) this.finish();
- this.event('afterFinish');
- return;
- }
- var pos = (timePos - this.startOn) / (this.finishOn - this.startOn);
- var frame = Math.round(pos * this.options.fps * this.options.duration);
- if(frame > this.currentFrame) {
- this.render(pos);
- this.currentFrame = frame;
- }
- }
- },
- render: function(pos) {
- if(this.state == 'idle') {
- this.state = 'running';
- this.event('beforeSetup');
- if(this.setup) this.setup();
- this.event('afterSetup');
- }
- if(this.state == 'running') {
- if(this.options.transition) pos = this.options.transition(pos);
- pos *= (this.options.to-this.options.from);
- pos += this.options.from;
- this.position = pos;
- this.event('beforeUpdate');
- if(this.update) this.update(pos);
- this.event('afterUpdate');
- }
- },
- cancel: function() {
- if(!this.options.sync)
- Effect.Queues.get(typeof this.options.queue == 'string' ?
- 'global' : this.options.queue.scope).remove(this);
- this.state = 'finished';
- },
- event: function(eventName) {
- if(this.options[eventName + 'Internal']) this.options[eventName + 'Internal'](this);
- if(this.options[eventName]) this.options[eventName](this);
- },
- inspect: function() {
- return '#';
- }
-}
-
-Effect.Parallel = Class.create();
-Object.extend(Object.extend(Effect.Parallel.prototype, Effect.Base.prototype), {
- initialize: function(effects) {
- this.effects = effects || [];
- this.start(arguments[1]);
- },
- update: function(position) {
- this.effects.invoke('render', position);
- },
- finish: function(position) {
- this.effects.each( function(effect) {
- effect.render(1.0);
- effect.cancel();
- effect.event('beforeFinish');
- if(effect.finish) effect.finish(position);
- effect.event('afterFinish');
- });
- }
-});
-
-Effect.Opacity = Class.create();
-Object.extend(Object.extend(Effect.Opacity.prototype, Effect.Base.prototype), {
- initialize: function(element) {
- this.element = $(element);
- // make this work on IE on elements without 'layout'
- if(/MSIE/.test(navigator.userAgent) && (!this.element.hasLayout))
- this.element.setStyle({zoom: 1});
- var options = Object.extend({
- from: this.element.getOpacity() || 0.0,
- to: 1.0
- }, arguments[1] || {});
- this.start(options);
- },
- update: function(position) {
- this.element.setOpacity(position);
- }
-});
-
-Effect.Move = Class.create();
-Object.extend(Object.extend(Effect.Move.prototype, Effect.Base.prototype), {
- initialize: function(element) {
- this.element = $(element);
- var options = Object.extend({
- x: 0,
- y: 0,
- mode: 'relative'
- }, arguments[1] || {});
- this.start(options);
- },
- setup: function() {
- // Bug in Opera: Opera returns the "real" position of a static element or
- // relative element that does not have top/left explicitly set.
- // ==> Always set top and left for position relative elements in your stylesheets
- // (to 0 if you do not need them)
- this.element.makePositioned();
- this.originalLeft = parseFloat(this.element.getStyle('left') || '0');
- this.originalTop = parseFloat(this.element.getStyle('top') || '0');
- if(this.options.mode == 'absolute') {
- // absolute movement, so we need to calc deltaX and deltaY
- this.options.x = this.options.x - this.originalLeft;
- this.options.y = this.options.y - this.originalTop;
- }
- },
- update: function(position) {
- this.element.setStyle({
- left: this.options.x * position + this.originalLeft + 'px',
- top: this.options.y * position + this.originalTop + 'px'
- });
- }
-});
-
-// for backwards compatibility
-Effect.MoveBy = function(element, toTop, toLeft) {
- return new Effect.Move(element,
- Object.extend({ x: toLeft, y: toTop }, arguments[3] || {}));
-};
-
-Effect.Scale = Class.create();
-Object.extend(Object.extend(Effect.Scale.prototype, Effect.Base.prototype), {
- initialize: function(element, percent) {
- this.element = $(element)
- var options = Object.extend({
- scaleX: true,
- scaleY: true,
- scaleContent: true,
- scaleFromCenter: false,
- scaleMode: 'box', // 'box' or 'contents' or {} with provided values
- scaleFrom: 100.0,
- scaleTo: percent
- }, arguments[2] || {});
- this.start(options);
- },
- setup: function() {
- this.restoreAfterFinish = this.options.restoreAfterFinish || false;
- this.elementPositioning = this.element.getStyle('position');
-
- this.originalStyle = {};
- ['top','left','width','height','fontSize'].each( function(k) {
- this.originalStyle[k] = this.element.style[k];
- }.bind(this));
-
- this.originalTop = this.element.offsetTop;
- this.originalLeft = this.element.offsetLeft;
-
- var fontSize = this.element.getStyle('font-size') || '100%';
- ['em','px','%'].each( function(fontSizeType) {
- if(fontSize.indexOf(fontSizeType)>0) {
- this.fontSize = parseFloat(fontSize);
- this.fontSizeType = fontSizeType;
- }
- }.bind(this));
-
- this.factor = (this.options.scaleTo - this.options.scaleFrom)/100;
-
- this.dims = null;
- if(this.options.scaleMode=='box')
- this.dims = [this.element.offsetHeight, this.element.offsetWidth];
- if(/^content/.test(this.options.scaleMode))
- this.dims = [this.element.scrollHeight, this.element.scrollWidth];
- if(!this.dims)
- this.dims = [this.options.scaleMode.originalHeight,
- this.options.scaleMode.originalWidth];
- },
- update: function(position) {
- var currentScale = (this.options.scaleFrom/100.0) + (this.factor * position);
- if(this.options.scaleContent && this.fontSize)
- this.element.setStyle({fontSize: this.fontSize * currentScale + this.fontSizeType });
- this.setDimensions(this.dims[0] * currentScale, this.dims[1] * currentScale);
- },
- finish: function(position) {
- if (this.restoreAfterFinish) this.element.setStyle(this.originalStyle);
- },
- setDimensions: function(height, width) {
- var d = {};
- if(this.options.scaleX) d.width = width + 'px';
- if(this.options.scaleY) d.height = height + 'px';
- if(this.options.scaleFromCenter) {
- var topd = (height - this.dims[0])/2;
- var leftd = (width - this.dims[1])/2;
- if(this.elementPositioning == 'absolute') {
- if(this.options.scaleY) d.top = this.originalTop-topd + 'px';
- if(this.options.scaleX) d.left = this.originalLeft-leftd + 'px';
- } else {
- if(this.options.scaleY) d.top = -topd + 'px';
- if(this.options.scaleX) d.left = -leftd + 'px';
- }
- }
- this.element.setStyle(d);
- }
-});
-
-Effect.Highlight = Class.create();
-Object.extend(Object.extend(Effect.Highlight.prototype, Effect.Base.prototype), {
- initialize: function(element) {
- this.element = $(element);
- var options = Object.extend({ startcolor: '#ffff99' }, arguments[1] || {});
- this.start(options);
- },
- setup: function() {
- // Prevent executing on elements not in the layout flow
- if(this.element.getStyle('display')=='none') { this.cancel(); return; }
- // Disable background image during the effect
- this.oldStyle = {
- backgroundImage: this.element.getStyle('background-image') };
- this.element.setStyle({backgroundImage: 'none'});
- if(!this.options.endcolor)
- this.options.endcolor = this.element.getStyle('background-color').parseColor('#ffffff');
- if(!this.options.restorecolor)
- this.options.restorecolor = this.element.getStyle('background-color');
- // init color calculations
- this._base = $R(0,2).map(function(i){ return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16) }.bind(this));
- this._delta = $R(0,2).map(function(i){ return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i] }.bind(this));
- },
- update: function(position) {
- this.element.setStyle({backgroundColor: $R(0,2).inject('#',function(m,v,i){
- return m+(Math.round(this._base[i]+(this._delta[i]*position)).toColorPart()); }.bind(this)) });
- },
- finish: function() {
- this.element.setStyle(Object.extend(this.oldStyle, {
- backgroundColor: this.options.restorecolor
- }));
- }
-});
-
-Effect.ScrollTo = Class.create();
-Object.extend(Object.extend(Effect.ScrollTo.prototype, Effect.Base.prototype), {
- initialize: function(element) {
- this.element = $(element);
- this.start(arguments[1] || {});
- },
- setup: function() {
- Position.prepare();
- var offsets = Position.cumulativeOffset(this.element);
- if(this.options.offset) offsets[1] += this.options.offset;
- var max = window.innerHeight ?
- window.height - window.innerHeight :
- document.body.scrollHeight -
- (document.documentElement.clientHeight ?
- document.documentElement.clientHeight : document.body.clientHeight);
- this.scrollStart = Position.deltaY;
- this.delta = (offsets[1] > max ? max : offsets[1]) - this.scrollStart;
- },
- update: function(position) {
- Position.prepare();
- window.scrollTo(Position.deltaX,
- this.scrollStart + (position*this.delta));
- }
-});
-
-/* ------------- combination effects ------------- */
-
-Effect.Fade = function(element) {
- element = $(element);
- var oldOpacity = element.getInlineOpacity();
- var options = Object.extend({
- from: element.getOpacity() || 1.0,
- to: 0.0,
- afterFinishInternal: function(effect) {
- if(effect.options.to!=0) return;
- effect.element.hide();
- effect.element.setStyle({opacity: oldOpacity});
- }}, arguments[1] || {});
- return new Effect.Opacity(element,options);
-}
-
-Effect.Appear = function(element) {
- element = $(element);
- var options = Object.extend({
- from: (element.getStyle('display') == 'none' ? 0.0 : element.getOpacity() || 0.0),
- to: 1.0,
- // force Safari to render floated elements properly
- afterFinishInternal: function(effect) {
- effect.element.forceRerendering();
- },
- beforeSetup: function(effect) {
- effect.element.setOpacity(effect.options.from);
- effect.element.show();
- }}, arguments[1] || {});
- return new Effect.Opacity(element,options);
-}
-
-Effect.Puff = function(element) {
- element = $(element);
- var oldStyle = { opacity: element.getInlineOpacity(), position: element.getStyle('position') };
- return new Effect.Parallel(
- [ new Effect.Scale(element, 200,
- { sync: true, scaleFromCenter: true, scaleContent: true, restoreAfterFinish: true }),
- new Effect.Opacity(element, { sync: true, to: 0.0 } ) ],
- Object.extend({ duration: 1.0,
- beforeSetupInternal: function(effect) {
- effect.effects[0].element.setStyle({position: 'absolute'}); },
- afterFinishInternal: function(effect) {
- effect.effects[0].element.hide();
- effect.effects[0].element.setStyle(oldStyle); }
- }, arguments[1] || {})
- );
-}
-
-Effect.BlindUp = function(element) {
- element = $(element);
- element.makeClipping();
- return new Effect.Scale(element, 0,
- Object.extend({ scaleContent: false,
- scaleX: false,
- restoreAfterFinish: true,
- afterFinishInternal: function(effect) {
- effect.element.hide();
- effect.element.undoClipping();
- }
- }, arguments[1] || {})
- );
-}
-
-Effect.BlindDown = function(element) {
- element = $(element);
- var elementDimensions = element.getDimensions();
- return new Effect.Scale(element, 100,
- Object.extend({ scaleContent: false,
- scaleX: false,
- scaleFrom: 0,
- scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
- restoreAfterFinish: true,
- afterSetup: function(effect) {
- effect.element.makeClipping();
- effect.element.setStyle({height: '0px'});
- effect.element.show();
- },
- afterFinishInternal: function(effect) {
- effect.element.undoClipping();
- }
- }, arguments[1] || {})
- );
-}
-
-Effect.SwitchOff = function(element) {
- element = $(element);
- var oldOpacity = element.getInlineOpacity();
- return new Effect.Appear(element, {
- duration: 0.4,
- from: 0,
- transition: Effect.Transitions.flicker,
- afterFinishInternal: function(effect) {
- new Effect.Scale(effect.element, 1, {
- duration: 0.3, scaleFromCenter: true,
- scaleX: false, scaleContent: false, restoreAfterFinish: true,
- beforeSetup: function(effect) {
- effect.element.makePositioned();
- effect.element.makeClipping();
- },
- afterFinishInternal: function(effect) {
- effect.element.hide();
- effect.element.undoClipping();
- effect.element.undoPositioned();
- effect.element.setStyle({opacity: oldOpacity});
- }
- })
- }
- });
-}
-
-Effect.DropOut = function(element) {
- element = $(element);
- var oldStyle = {
- top: element.getStyle('top'),
- left: element.getStyle('left'),
- opacity: element.getInlineOpacity() };
- return new Effect.Parallel(
- [ new Effect.Move(element, {x: 0, y: 100, sync: true }),
- new Effect.Opacity(element, { sync: true, to: 0.0 }) ],
- Object.extend(
- { duration: 0.5,
- beforeSetup: function(effect) {
- effect.effects[0].element.makePositioned();
- },
- afterFinishInternal: function(effect) {
- effect.effects[0].element.hide();
- effect.effects[0].element.undoPositioned();
- effect.effects[0].element.setStyle(oldStyle);
- }
- }, arguments[1] || {}));
-}
-
-Effect.Shake = function(element) {
- element = $(element);
- var oldStyle = {
- top: element.getStyle('top'),
- left: element.getStyle('left') };
- return new Effect.Move(element,
- { x: 20, y: 0, duration: 0.05, afterFinishInternal: function(effect) {
- new Effect.Move(effect.element,
- { x: -40, y: 0, duration: 0.1, afterFinishInternal: function(effect) {
- new Effect.Move(effect.element,
- { x: 40, y: 0, duration: 0.1, afterFinishInternal: function(effect) {
- new Effect.Move(effect.element,
- { x: -40, y: 0, duration: 0.1, afterFinishInternal: function(effect) {
- new Effect.Move(effect.element,
- { x: 40, y: 0, duration: 0.1, afterFinishInternal: function(effect) {
- new Effect.Move(effect.element,
- { x: -20, y: 0, duration: 0.05, afterFinishInternal: function(effect) {
- effect.element.undoPositioned();
- effect.element.setStyle(oldStyle);
- }}) }}) }}) }}) }}) }});
-}
-
-Effect.SlideDown = function(element) {
- element = $(element);
- element.cleanWhitespace();
- // SlideDown need to have the content of the element wrapped in a container element with fixed height!
- var oldInnerBottom = $(element.firstChild).getStyle('bottom');
- var elementDimensions = element.getDimensions();
- return new Effect.Scale(element, 100, Object.extend({
- scaleContent: false,
- scaleX: false,
- scaleFrom: window.opera ? 0 : 1,
- scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
- restoreAfterFinish: true,
- afterSetup: function(effect) {
- effect.element.makePositioned();
- effect.element.firstChild.makePositioned();
- if(window.opera) effect.element.setStyle({top: ''});
- effect.element.makeClipping();
- effect.element.setStyle({height: '0px'});
- effect.element.show(); },
- afterUpdateInternal: function(effect) {
- effect.element.firstChild.setStyle({bottom:
- (effect.dims[0] - effect.element.clientHeight) + 'px' });
- },
- afterFinishInternal: function(effect) {
- effect.element.undoClipping();
- // IE will crash if child is undoPositioned first
- if(/MSIE/.test(navigator.userAgent)){
- effect.element.undoPositioned();
- effect.element.firstChild.undoPositioned();
- }else{
- effect.element.firstChild.undoPositioned();
- effect.element.undoPositioned();
- }
- effect.element.firstChild.setStyle({bottom: oldInnerBottom}); }
- }, arguments[1] || {})
- );
-}
-
-Effect.SlideUp = function(element) {
- element = $(element);
- element.cleanWhitespace();
- var oldInnerBottom = $(element.firstChild).getStyle('bottom');
- return new Effect.Scale(element, window.opera ? 0 : 1,
- Object.extend({ scaleContent: false,
- scaleX: false,
- scaleMode: 'box',
- scaleFrom: 100,
- restoreAfterFinish: true,
- beforeStartInternal: function(effect) {
- effect.element.makePositioned();
- effect.element.firstChild.makePositioned();
- if(window.opera) effect.element.setStyle({top: ''});
- effect.element.makeClipping();
- effect.element.show(); },
- afterUpdateInternal: function(effect) {
- effect.element.firstChild.setStyle({bottom:
- (effect.dims[0] - effect.element.clientHeight) + 'px' }); },
- afterFinishInternal: function(effect) {
- effect.element.hide();
- effect.element.undoClipping();
- effect.element.firstChild.undoPositioned();
- effect.element.undoPositioned();
- effect.element.setStyle({bottom: oldInnerBottom}); }
- }, arguments[1] || {})
- );
-}
-
-// Bug in opera makes the TD containing this element expand for a instance after finish
-Effect.Squish = function(element) {
- return new Effect.Scale(element, window.opera ? 1 : 0,
- { restoreAfterFinish: true,
- beforeSetup: function(effect) {
- effect.element.makeClipping(effect.element); },
- afterFinishInternal: function(effect) {
- effect.element.hide(effect.element);
- effect.element.undoClipping(effect.element); }
- });
-}
-
-Effect.Grow = function(element) {
- element = $(element);
- var options = Object.extend({
- direction: 'center',
- moveTransition: Effect.Transitions.sinoidal,
- scaleTransition: Effect.Transitions.sinoidal,
- opacityTransition: Effect.Transitions.full
- }, arguments[1] || {});
- var oldStyle = {
- top: element.style.top,
- left: element.style.left,
- height: element.style.height,
- width: element.style.width,
- opacity: element.getInlineOpacity() };
-
- var dims = element.getDimensions();
- var initialMoveX, initialMoveY;
- var moveX, moveY;
-
- switch (options.direction) {
- case 'top-left':
- initialMoveX = initialMoveY = moveX = moveY = 0;
- break;
- case 'top-right':
- initialMoveX = dims.width;
- initialMoveY = moveY = 0;
- moveX = -dims.width;
- break;
- case 'bottom-left':
- initialMoveX = moveX = 0;
- initialMoveY = dims.height;
- moveY = -dims.height;
- break;
- case 'bottom-right':
- initialMoveX = dims.width;
- initialMoveY = dims.height;
- moveX = -dims.width;
- moveY = -dims.height;
- break;
- case 'center':
- initialMoveX = dims.width / 2;
- initialMoveY = dims.height / 2;
- moveX = -dims.width / 2;
- moveY = -dims.height / 2;
- break;
- }
-
- return new Effect.Move(element, {
- x: initialMoveX,
- y: initialMoveY,
- duration: 0.01,
- beforeSetup: function(effect) {
- effect.element.hide();
- effect.element.makeClipping();
- effect.element.makePositioned();
- },
- afterFinishInternal: function(effect) {
- new Effect.Parallel(
- [ new Effect.Opacity(effect.element, { sync: true, to: 1.0, from: 0.0, transition: options.opacityTransition }),
- new Effect.Move(effect.element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }),
- new Effect.Scale(effect.element, 100, {
- scaleMode: { originalHeight: dims.height, originalWidth: dims.width },
- sync: true, scaleFrom: window.opera ? 1 : 0, transition: options.scaleTransition, restoreAfterFinish: true})
- ], Object.extend({
- beforeSetup: function(effect) {
- effect.effects[0].element.setStyle({height: '0px'});
- effect.effects[0].element.show();
- },
- afterFinishInternal: function(effect) {
- effect.effects[0].element.undoClipping();
- effect.effects[0].element.undoPositioned();
- effect.effects[0].element.setStyle(oldStyle);
- }
- }, options)
- )
- }
- });
-}
-
-Effect.Shrink = function(element) {
- element = $(element);
- var options = Object.extend({
- direction: 'center',
- moveTransition: Effect.Transitions.sinoidal,
- scaleTransition: Effect.Transitions.sinoidal,
- opacityTransition: Effect.Transitions.none
- }, arguments[1] || {});
- var oldStyle = {
- top: element.style.top,
- left: element.style.left,
- height: element.style.height,
- width: element.style.width,
- opacity: element.getInlineOpacity() };
-
- var dims = element.getDimensions();
- var moveX, moveY;
-
- switch (options.direction) {
- case 'top-left':
- moveX = moveY = 0;
- break;
- case 'top-right':
- moveX = dims.width;
- moveY = 0;
- break;
- case 'bottom-left':
- moveX = 0;
- moveY = dims.height;
- break;
- case 'bottom-right':
- moveX = dims.width;
- moveY = dims.height;
- break;
- case 'center':
- moveX = dims.width / 2;
- moveY = dims.height / 2;
- break;
- }
-
- return new Effect.Parallel(
- [ new Effect.Opacity(element, { sync: true, to: 0.0, from: 1.0, transition: options.opacityTransition }),
- new Effect.Scale(element, window.opera ? 1 : 0, { sync: true, transition: options.scaleTransition, restoreAfterFinish: true}),
- new Effect.Move(element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition })
- ], Object.extend({
- beforeStartInternal: function(effect) {
- effect.effects[0].element.makePositioned();
- effect.effects[0].element.makeClipping(); },
- afterFinishInternal: function(effect) {
- effect.effects[0].element.hide();
- effect.effects[0].element.undoClipping();
- effect.effects[0].element.undoPositioned();
- effect.effects[0].element.setStyle(oldStyle); }
- }, options)
- );
-}
-
-Effect.Pulsate = function(element) {
- element = $(element);
- var options = arguments[1] || {};
- var oldOpacity = element.getInlineOpacity();
- var transition = options.transition || Effect.Transitions.sinoidal;
- var reverser = function(pos){ return transition(1-Effect.Transitions.pulse(pos)) };
- reverser.bind(transition);
- return new Effect.Opacity(element,
- Object.extend(Object.extend({ duration: 3.0, from: 0,
- afterFinishInternal: function(effect) { effect.element.setStyle({opacity: oldOpacity}); }
- }, options), {transition: reverser}));
-}
-
-Effect.Fold = function(element) {
- element = $(element);
- var oldStyle = {
- top: element.style.top,
- left: element.style.left,
- width: element.style.width,
- height: element.style.height };
- Element.makeClipping(element);
- return new Effect.Scale(element, 5, Object.extend({
- scaleContent: false,
- scaleX: false,
- afterFinishInternal: function(effect) {
- new Effect.Scale(element, 1, {
- scaleContent: false,
- scaleY: false,
- afterFinishInternal: function(effect) {
- effect.element.hide();
- effect.element.undoClipping();
- effect.element.setStyle(oldStyle);
- } });
- }}, arguments[1] || {}));
-};
-
-['setOpacity','getOpacity','getInlineOpacity','forceRerendering','setContentZoom',
- 'collectTextNodes','collectTextNodesIgnoreClass','childrenWithClassName'].each(
- function(f) { Element.Methods[f] = Element[f]; }
-);
-
-Element.Methods.visualEffect = function(element, effect, options) {
- s = effect.gsub(/_/, '-').camelize();
- effect_class = s.charAt(0).toUpperCase() + s.substring(1);
- new Effect[effect_class](element, options);
- return $(element);
-};
-
-Element.addMethods();
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/selenium-core/lib/scriptaculous/scriptaculous.js b/vendor/plugins/selenium-on-rails/selenium-core/lib/scriptaculous/scriptaculous.js
deleted file mode 100644
index f61fc57f..00000000
--- a/vendor/plugins/selenium-on-rails/selenium-core/lib/scriptaculous/scriptaculous.js
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-var Scriptaculous = {
- Version: '1.6.1',
- require: function(libraryName) {
- // inserting via DOM fails in Safari 2.0, so brute force approach
- document.write('');
- },
- load: function() {
- if((typeof Prototype=='undefined') ||
- (typeof Element == 'undefined') ||
- (typeof Element.Methods=='undefined') ||
- parseFloat(Prototype.Version.split(".")[0] + "." +
- Prototype.Version.split(".")[1]) < 1.5)
- throw("script.aculo.us requires the Prototype JavaScript framework >= 1.5.0");
-
- $A(document.getElementsByTagName("script")).findAll( function(s) {
- return (s.src && s.src.match(/scriptaculous\.js(\?.*)?$/))
- }).each( function(s) {
- var path = s.src.replace(/scriptaculous\.js(\?.*)?$/,'');
- var includes = s.src.match(/\?.*load=([a-z,]*)/);
- (includes ? includes[1] : 'builder,effects,dragdrop,controls,slider').split(',').each(
- function(include) { Scriptaculous.require(path+include+'.js') });
- });
- }
-}
-
-Scriptaculous.load();
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/selenium-core/lib/scriptaculous/slider.js b/vendor/plugins/selenium-on-rails/selenium-core/lib/scriptaculous/slider.js
deleted file mode 100644
index c0f1fc01..00000000
--- a/vendor/plugins/selenium-on-rails/selenium-core/lib/scriptaculous/slider.js
+++ /dev/null
@@ -1,283 +0,0 @@
-// Copyright (c) 2005 Marty Haught, Thomas Fuchs
-//
-// See http://script.aculo.us for more info
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-if(!Control) var Control = {};
-Control.Slider = Class.create();
-
-// options:
-// axis: 'vertical', or 'horizontal' (default)
-//
-// callbacks:
-// onChange(value)
-// onSlide(value)
-Control.Slider.prototype = {
- initialize: function(handle, track, options) {
- var slider = this;
-
- if(handle instanceof Array) {
- this.handles = handle.collect( function(e) { return $(e) });
- } else {
- this.handles = [$(handle)];
- }
-
- this.track = $(track);
- this.options = options || {};
-
- this.axis = this.options.axis || 'horizontal';
- this.increment = this.options.increment || 1;
- this.step = parseInt(this.options.step || '1');
- this.range = this.options.range || $R(0,1);
-
- this.value = 0; // assure backwards compat
- this.values = this.handles.map( function() { return 0 });
- this.spans = this.options.spans ? this.options.spans.map(function(s){ return $(s) }) : false;
- this.options.startSpan = $(this.options.startSpan || null);
- this.options.endSpan = $(this.options.endSpan || null);
-
- this.restricted = this.options.restricted || false;
-
- this.maximum = this.options.maximum || this.range.end;
- this.minimum = this.options.minimum || this.range.start;
-
- // Will be used to align the handle onto the track, if necessary
- this.alignX = parseInt(this.options.alignX || '0');
- this.alignY = parseInt(this.options.alignY || '0');
-
- this.trackLength = this.maximumOffset() - this.minimumOffset();
- this.handleLength = this.isVertical() ? this.handles[0].offsetHeight : this.handles[0].offsetWidth;
-
- this.active = false;
- this.dragging = false;
- this.disabled = false;
-
- if(this.options.disabled) this.setDisabled();
-
- // Allowed values array
- this.allowedValues = this.options.values ? this.options.values.sortBy(Prototype.K) : false;
- if(this.allowedValues) {
- this.minimum = this.allowedValues.min();
- this.maximum = this.allowedValues.max();
- }
-
- this.eventMouseDown = this.startDrag.bindAsEventListener(this);
- this.eventMouseUp = this.endDrag.bindAsEventListener(this);
- this.eventMouseMove = this.update.bindAsEventListener(this);
-
- // Initialize handles in reverse (make sure first handle is active)
- this.handles.each( function(h,i) {
- i = slider.handles.length-1-i;
- slider.setValue(parseFloat(
- (slider.options.sliderValue instanceof Array ?
- slider.options.sliderValue[i] : slider.options.sliderValue) ||
- slider.range.start), i);
- Element.makePositioned(h); // fix IE
- Event.observe(h, "mousedown", slider.eventMouseDown);
- });
-
- Event.observe(this.track, "mousedown", this.eventMouseDown);
- Event.observe(document, "mouseup", this.eventMouseUp);
- Event.observe(document, "mousemove", this.eventMouseMove);
-
- this.initialized = true;
- },
- dispose: function() {
- var slider = this;
- Event.stopObserving(this.track, "mousedown", this.eventMouseDown);
- Event.stopObserving(document, "mouseup", this.eventMouseUp);
- Event.stopObserving(document, "mousemove", this.eventMouseMove);
- this.handles.each( function(h) {
- Event.stopObserving(h, "mousedown", slider.eventMouseDown);
- });
- },
- setDisabled: function(){
- this.disabled = true;
- },
- setEnabled: function(){
- this.disabled = false;
- },
- getNearestValue: function(value){
- if(this.allowedValues){
- if(value >= this.allowedValues.max()) return(this.allowedValues.max());
- if(value <= this.allowedValues.min()) return(this.allowedValues.min());
-
- var offset = Math.abs(this.allowedValues[0] - value);
- var newValue = this.allowedValues[0];
- this.allowedValues.each( function(v) {
- var currentOffset = Math.abs(v - value);
- if(currentOffset <= offset){
- newValue = v;
- offset = currentOffset;
- }
- });
- return newValue;
- }
- if(value > this.range.end) return this.range.end;
- if(value < this.range.start) return this.range.start;
- return value;
- },
- setValue: function(sliderValue, handleIdx){
- if(!this.active) {
- this.activeHandle = this.handles[handleIdx];
- this.activeHandleIdx = handleIdx;
- this.updateStyles();
- }
- handleIdx = handleIdx || this.activeHandleIdx || 0;
- if(this.initialized && this.restricted) {
- if((handleIdx>0) && (sliderValuethis.values[handleIdx+1]))
- sliderValue = this.values[handleIdx+1];
- }
- sliderValue = this.getNearestValue(sliderValue);
- this.values[handleIdx] = sliderValue;
- this.value = this.values[0]; // assure backwards compat
-
- this.handles[handleIdx].style[this.isVertical() ? 'top' : 'left'] =
- this.translateToPx(sliderValue);
-
- this.drawSpans();
- if(!this.dragging || !this.event) this.updateFinished();
- },
- setValueBy: function(delta, handleIdx) {
- this.setValue(this.values[handleIdx || this.activeHandleIdx || 0] + delta,
- handleIdx || this.activeHandleIdx || 0);
- },
- translateToPx: function(value) {
- return Math.round(
- ((this.trackLength-this.handleLength)/(this.range.end-this.range.start)) *
- (value - this.range.start)) + "px";
- },
- translateToValue: function(offset) {
- return ((offset/(this.trackLength-this.handleLength) *
- (this.range.end-this.range.start)) + this.range.start);
- },
- getRange: function(range) {
- var v = this.values.sortBy(Prototype.K);
- range = range || 0;
- return $R(v[range],v[range+1]);
- },
- minimumOffset: function(){
- return(this.isVertical() ? this.alignY : this.alignX);
- },
- maximumOffset: function(){
- return(this.isVertical() ?
- this.track.offsetHeight - this.alignY : this.track.offsetWidth - this.alignX);
- },
- isVertical: function(){
- return (this.axis == 'vertical');
- },
- drawSpans: function() {
- var slider = this;
- if(this.spans)
- $R(0, this.spans.length-1).each(function(r) { slider.setSpan(slider.spans[r], slider.getRange(r)) });
- if(this.options.startSpan)
- this.setSpan(this.options.startSpan,
- $R(0, this.values.length>1 ? this.getRange(0).min() : this.value ));
- if(this.options.endSpan)
- this.setSpan(this.options.endSpan,
- $R(this.values.length>1 ? this.getRange(this.spans.length-1).max() : this.value, this.maximum));
- },
- setSpan: function(span, range) {
- if(this.isVertical()) {
- span.style.top = this.translateToPx(range.start);
- span.style.height = this.translateToPx(range.end - range.start + this.range.start);
- } else {
- span.style.left = this.translateToPx(range.start);
- span.style.width = this.translateToPx(range.end - range.start + this.range.start);
- }
- },
- updateStyles: function() {
- this.handles.each( function(h){ Element.removeClassName(h, 'selected') });
- Element.addClassName(this.activeHandle, 'selected');
- },
- startDrag: function(event) {
- if(Event.isLeftClick(event)) {
- if(!this.disabled){
- this.active = true;
-
- var handle = Event.element(event);
- var pointer = [Event.pointerX(event), Event.pointerY(event)];
- if(handle==this.track) {
- var offsets = Position.cumulativeOffset(this.track);
- this.event = event;
- this.setValue(this.translateToValue(
- (this.isVertical() ? pointer[1]-offsets[1] : pointer[0]-offsets[0])-(this.handleLength/2)
- ));
- var offsets = Position.cumulativeOffset(this.activeHandle);
- this.offsetX = (pointer[0] - offsets[0]);
- this.offsetY = (pointer[1] - offsets[1]);
- } else {
- // find the handle (prevents issues with Safari)
- while((this.handles.indexOf(handle) == -1) && handle.parentNode)
- handle = handle.parentNode;
-
- this.activeHandle = handle;
- this.activeHandleIdx = this.handles.indexOf(this.activeHandle);
- this.updateStyles();
-
- var offsets = Position.cumulativeOffset(this.activeHandle);
- this.offsetX = (pointer[0] - offsets[0]);
- this.offsetY = (pointer[1] - offsets[1]);
- }
- }
- Event.stop(event);
- }
- },
- update: function(event) {
- if(this.active) {
- if(!this.dragging) this.dragging = true;
- this.draw(event);
- // fix AppleWebKit rendering
- if(navigator.appVersion.indexOf('AppleWebKit')>0) window.scrollBy(0,0);
- Event.stop(event);
- }
- },
- draw: function(event) {
- var pointer = [Event.pointerX(event), Event.pointerY(event)];
- var offsets = Position.cumulativeOffset(this.track);
- pointer[0] -= this.offsetX + offsets[0];
- pointer[1] -= this.offsetY + offsets[1];
- this.event = event;
- this.setValue(this.translateToValue( this.isVertical() ? pointer[1] : pointer[0] ));
- if(this.initialized && this.options.onSlide)
- this.options.onSlide(this.values.length>1 ? this.values : this.value, this);
- },
- endDrag: function(event) {
- if(this.active && this.dragging) {
- this.finishDrag(event, true);
- Event.stop(event);
- }
- this.active = false;
- this.dragging = false;
- },
- finishDrag: function(event, success) {
- this.active = false;
- this.dragging = false;
- this.updateFinished();
- },
- updateFinished: function() {
- if(this.initialized && this.options.onChange)
- this.options.onChange(this.values.length>1 ? this.values : this.value, this);
- this.event = null;
- }
-}
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/selenium-core/lib/scriptaculous/unittest.js b/vendor/plugins/selenium-on-rails/selenium-core/lib/scriptaculous/unittest.js
deleted file mode 100644
index d2c2d817..00000000
--- a/vendor/plugins/selenium-on-rails/selenium-core/lib/scriptaculous/unittest.js
+++ /dev/null
@@ -1,383 +0,0 @@
-// Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
-// (c) 2005 Jon Tirsen (http://www.tirsen.com)
-// (c) 2005 Michael Schuerig (http://www.schuerig.de/michael/)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-
-// experimental, Firefox-only
-Event.simulateMouse = function(element, eventName) {
- var options = Object.extend({
- pointerX: 0,
- pointerY: 0,
- buttons: 0
- }, arguments[2] || {});
- var oEvent = document.createEvent("MouseEvents");
- oEvent.initMouseEvent(eventName, true, true, document.defaultView,
- options.buttons, options.pointerX, options.pointerY, options.pointerX, options.pointerY,
- false, false, false, false, 0, $(element));
-
- if(this.mark) Element.remove(this.mark);
- this.mark = document.createElement('div');
- this.mark.appendChild(document.createTextNode(" "));
- document.body.appendChild(this.mark);
- this.mark.style.position = 'absolute';
- this.mark.style.top = options.pointerY + "px";
- this.mark.style.left = options.pointerX + "px";
- this.mark.style.width = "5px";
- this.mark.style.height = "5px;";
- this.mark.style.borderTop = "1px solid red;"
- this.mark.style.borderLeft = "1px solid red;"
-
- if(this.step)
- alert('['+new Date().getTime().toString()+'] '+eventName+'/'+Test.Unit.inspect(options));
-
- $(element).dispatchEvent(oEvent);
-};
-
-// Note: Due to a fix in Firefox 1.0.5/6 that probably fixed "too much", this doesn't work in 1.0.6 or DP2.
-// You need to downgrade to 1.0.4 for now to get this working
-// See https://bugzilla.mozilla.org/show_bug.cgi?id=289940 for the fix that fixed too much
-Event.simulateKey = function(element, eventName) {
- var options = Object.extend({
- ctrlKey: false,
- altKey: false,
- shiftKey: false,
- metaKey: false,
- keyCode: 0,
- charCode: 0
- }, arguments[2] || {});
-
- var oEvent = document.createEvent("KeyEvents");
- oEvent.initKeyEvent(eventName, true, true, window,
- options.ctrlKey, options.altKey, options.shiftKey, options.metaKey,
- options.keyCode, options.charCode );
- $(element).dispatchEvent(oEvent);
-};
-
-Event.simulateKeys = function(element, command) {
- for(var i=0; i' +
- '' +
- '| Status | Test | Message |
' +
- '' +
- '
';
- this.logsummary = $('logsummary')
- this.loglines = $('loglines');
- },
- _toHTML: function(txt) {
- return txt.escapeHTML().replace(/\n/g,"
");
- }
-}
-
-Test.Unit.Runner = Class.create();
-Test.Unit.Runner.prototype = {
- initialize: function(testcases) {
- this.options = Object.extend({
- testLog: 'testlog'
- }, arguments[1] || {});
- this.options.resultsURL = this.parseResultsURLQueryParameter();
- if (this.options.testLog) {
- this.options.testLog = $(this.options.testLog) || null;
- }
- if(this.options.tests) {
- this.tests = [];
- for(var i = 0; i < this.options.tests.length; i++) {
- if(/^test/.test(this.options.tests[i])) {
- this.tests.push(new Test.Unit.Testcase(this.options.tests[i], testcases[this.options.tests[i]], testcases["setup"], testcases["teardown"]));
- }
- }
- } else {
- if (this.options.test) {
- this.tests = [new Test.Unit.Testcase(this.options.test, testcases[this.options.test], testcases["setup"], testcases["teardown"])];
- } else {
- this.tests = [];
- for(var testcase in testcases) {
- if(/^test/.test(testcase)) {
- this.tests.push(new Test.Unit.Testcase(testcase, testcases[testcase], testcases["setup"], testcases["teardown"]));
- }
- }
- }
- }
- this.currentTest = 0;
- this.logger = new Test.Unit.Logger(this.options.testLog);
- setTimeout(this.runTests.bind(this), 1000);
- },
- parseResultsURLQueryParameter: function() {
- return window.location.search.parseQuery()["resultsURL"];
- },
- // Returns:
- // "ERROR" if there was an error,
- // "FAILURE" if there was a failure, or
- // "SUCCESS" if there was neither
- getResult: function() {
- var hasFailure = false;
- for(var i=0;i 0) {
- return "ERROR";
- }
- if (this.tests[i].failures > 0) {
- hasFailure = true;
- }
- }
- if (hasFailure) {
- return "FAILURE";
- } else {
- return "SUCCESS";
- }
- },
- postResults: function() {
- if (this.options.resultsURL) {
- new Ajax.Request(this.options.resultsURL,
- { method: 'get', parameters: 'result=' + this.getResult(), asynchronous: false });
- }
- },
- runTests: function() {
- var test = this.tests[this.currentTest];
- if (!test) {
- // finished!
- this.postResults();
- this.logger.summary(this.summary());
- return;
- }
- if(!test.isWaiting) {
- this.logger.start(test.name);
- }
- test.run();
- if(test.isWaiting) {
- this.logger.message("Waiting for " + test.timeToWait + "ms");
- setTimeout(this.runTests.bind(this), test.timeToWait || 1000);
- } else {
- this.logger.finish(test.status(), test.summary());
- this.currentTest++;
- // tail recursive, hopefully the browser will skip the stackframe
- this.runTests();
- }
- },
- summary: function() {
- var assertions = 0;
- var failures = 0;
- var errors = 0;
- var messages = [];
- for(var i=0;i 0) return 'failed';
- if (this.errors > 0) return 'error';
- return 'passed';
- },
- assert: function(expression) {
- var message = arguments[1] || 'assert: got "' + Test.Unit.inspect(expression) + '"';
- try { expression ? this.pass() :
- this.fail(message); }
- catch(e) { this.error(e); }
- },
- assertEqual: function(expected, actual) {
- var message = arguments[2] || "assertEqual";
- try { (expected == actual) ? this.pass() :
- this.fail(message + ': expected "' + Test.Unit.inspect(expected) +
- '", actual "' + Test.Unit.inspect(actual) + '"'); }
- catch(e) { this.error(e); }
- },
- assertEnumEqual: function(expected, actual) {
- var message = arguments[2] || "assertEnumEqual";
- try { $A(expected).length == $A(actual).length &&
- expected.zip(actual).all(function(pair) { return pair[0] == pair[1] }) ?
- this.pass() : this.fail(message + ': expected ' + Test.Unit.inspect(expected) +
- ', actual ' + Test.Unit.inspect(actual)); }
- catch(e) { this.error(e); }
- },
- assertNotEqual: function(expected, actual) {
- var message = arguments[2] || "assertNotEqual";
- try { (expected != actual) ? this.pass() :
- this.fail(message + ': got "' + Test.Unit.inspect(actual) + '"'); }
- catch(e) { this.error(e); }
- },
- assertNull: function(obj) {
- var message = arguments[1] || 'assertNull'
- try { (obj==null) ? this.pass() :
- this.fail(message + ': got "' + Test.Unit.inspect(obj) + '"'); }
- catch(e) { this.error(e); }
- },
- assertHidden: function(element) {
- var message = arguments[1] || 'assertHidden';
- this.assertEqual("none", element.style.display, message);
- },
- assertNotNull: function(object) {
- var message = arguments[1] || 'assertNotNull';
- this.assert(object != null, message);
- },
- assertInstanceOf: function(expected, actual) {
- var message = arguments[2] || 'assertInstanceOf';
- try {
- (actual instanceof expected) ? this.pass() :
- this.fail(message + ": object was not an instance of the expected type"); }
- catch(e) { this.error(e); }
- },
- assertNotInstanceOf: function(expected, actual) {
- var message = arguments[2] || 'assertNotInstanceOf';
- try {
- !(actual instanceof expected) ? this.pass() :
- this.fail(message + ": object was an instance of the not expected type"); }
- catch(e) { this.error(e); }
- },
- _isVisible: function(element) {
- element = $(element);
- if(!element.parentNode) return true;
- this.assertNotNull(element);
- if(element.style && Element.getStyle(element, 'display') == 'none')
- return false;
-
- return this._isVisible(element.parentNode);
- },
- assertNotVisible: function(element) {
- this.assert(!this._isVisible(element), Test.Unit.inspect(element) + " was not hidden and didn't have a hidden parent either. " + ("" || arguments[1]));
- },
- assertVisible: function(element) {
- this.assert(this._isVisible(element), Test.Unit.inspect(element) + " was not visible. " + ("" || arguments[1]));
- },
- benchmark: function(operation, iterations) {
- var startAt = new Date();
- (iterations || 1).times(operation);
- var timeTaken = ((new Date())-startAt);
- this.info((arguments[2] || 'Operation') + ' finished ' +
- iterations + ' iterations in ' + (timeTaken/1000)+'s' );
- return timeTaken;
- }
-}
-
-Test.Unit.Testcase = Class.create();
-Object.extend(Object.extend(Test.Unit.Testcase.prototype, Test.Unit.Assertions.prototype), {
- initialize: function(name, test, setup, teardown) {
- Test.Unit.Assertions.prototype.initialize.bind(this)();
- this.name = name;
- this.test = test || function() {};
- this.setup = setup || function() {};
- this.teardown = teardown || function() {};
- this.isWaiting = false;
- this.timeToWait = 1000;
- },
- wait: function(time, nextPart) {
- this.isWaiting = true;
- this.test = nextPart;
- this.timeToWait = time;
- },
- run: function() {
- try {
- try {
- if (!this.isWaiting) this.setup.bind(this)();
- this.isWaiting = false;
- this.test.bind(this)();
- } finally {
- if(!this.isWaiting) {
- this.teardown.bind(this)();
- }
- }
- }
- catch(e) { this.error(e); }
- }
-});
diff --git a/vendor/plugins/selenium-on-rails/selenium-core/lib/snapsie.js b/vendor/plugins/selenium-on-rails/selenium-core/lib/snapsie.js
deleted file mode 100644
index 23503792..00000000
--- a/vendor/plugins/selenium-on-rails/selenium-core/lib/snapsie.js
+++ /dev/null
@@ -1,91 +0,0 @@
-/**
- * This file wraps the Snapsie ActiveX object, exposing a single saveSnapshot()
- * method on a the object.
- *
- * See http://snapsie.sourceforge.net/
- */
-
-function Snapsie() {
- // private methods
-
- function isQuirksMode(inDocument) {
- return (inDocument.compatMode == 'BackCompat');
- }
-
- function getDrawableElement(inDocument) {
- if (isQuirksMode(inDocument)) {
- var body = inDocument.getElementsByTagName('body')[0];
- return body;
- }
- else {
- // standards mode
- return inDocument.documentElement;
- }
- }
-
- /**
- * Returns the canonical Windows path for a given path. This means
- * basically replacing any forwards slashes with backslashes.
- *
- * @param path the path whose canonical form to return
- */
- function getCanonicalPath(path) {
- path = path.replace(/\//g, '\\');
- path = path.replace(/\\\\/g, '\\');
- return path;
- }
-
- // public methods
-
- /**
- * Saves a screenshot of the current document to a file. If frameId is
- * specified, a screenshot of just the frame is captured instead.
- *
- * @param outputFile the file to which to save the screenshot
- * @param frameId the frame to capture; omit to capture entire document
- */
- this.saveSnapshot = function(outputFile, frameId) {
- var drawableElement = getDrawableElement(document);
- var drawableInfo = {
- overflow : drawableElement.style.overflow
- , scrollLeft: drawableElement.scrollLeft
- , scrollTop : drawableElement.scrollTop
- };
- drawableElement.style.overflow = 'hidden';
-
- var capturableDocument;
- var frameBCR = { left: 0, top: 0 };
- if (!frameId) {
- capturableDocument = document;
- }
- else {
- var frame = document.getElementById(frameId);
- capturableDocument = frame.document;
-
- // scroll as much of the frame into view as possible
- frameBCR = frame.getBoundingClientRect();
- window.scroll(frameBCR.left, frameBCR.top);
- frameBCR = frame.getBoundingClientRect();
- }
-
- var nativeObj = new ActiveXObject('Snapsie.CoSnapsie');
- nativeObj.saveSnapshot(
- getCanonicalPath(outputFile),
- frameId,
- drawableElement.scrollWidth,
- drawableElement.scrollHeight,
- drawableElement.clientWidth,
- drawableElement.clientHeight,
- drawableElement.clientLeft,
- drawableElement.clientTop,
- frameBCR.left,
- frameBCR.top
- );
-
- // revert
-
- drawableElement.style.overflow = drawableInfo.overflow;
- drawableElement.scrollLeft = drawableInfo.scrollLeft;
- drawableElement.scrollTop = drawableInfo.scrollTop;
- }
-};
diff --git a/vendor/plugins/selenium-on-rails/selenium-core/scripts/find_matching_child.js b/vendor/plugins/selenium-on-rails/selenium-core/scripts/find_matching_child.js
deleted file mode 100644
index e18a089b..00000000
--- a/vendor/plugins/selenium-on-rails/selenium-core/scripts/find_matching_child.js
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright 2004 ThoughtWorks, Inc
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-elementFindMatchingChildren = function(element, selector) {
- var matches = [];
-
- var childCount = element.childNodes.length;
- for (var i=0; i= "1.5");
- if (isRecentFirefox || browserVersion.isKonqueror || browserVersion.isSafari || browserVersion.isOpera) {
- text = getTextContent(element);
- } else if (element.textContent) {
- text = element.textContent;
- } else if (element.innerText) {
- text = element.innerText;
- }
-
- text = normalizeNewlines(text);
- text = normalizeSpaces(text);
-
- return text.trim();
-}
-
-function getTextContent(element, preformatted) {
- if (element.nodeType == 3 /*Node.TEXT_NODE*/) {
- var text = element.data;
- if (!preformatted) {
- text = text.replace(/\n|\r|\t/g, " ");
- }
- return text;
- }
- if (element.nodeType == 1 /*Node.ELEMENT_NODE*/) {
- var childrenPreformatted = preformatted || (element.tagName == "PRE");
- var text = "";
- for (var i = 0; i < element.childNodes.length; i++) {
- var child = element.childNodes.item(i);
- text += getTextContent(child, childrenPreformatted);
- }
- // Handle block elements that introduce newlines
- // -- From HTML spec:
- //
- //
- // TODO: should potentially introduce multiple newlines to separate blocks
- if (element.tagName == "P" || element.tagName == "BR" || element.tagName == "HR" || element.tagName == "DIV") {
- text += "\n";
- }
- return text;
- }
- return '';
-}
-
-/**
- * Convert all newlines to \n
- */
-function normalizeNewlines(text)
-{
- return text.replace(/\r\n|\r/g, "\n");
-}
-
-/**
- * Replace multiple sequential spaces with a single space, and then convert to space.
- */
-function normalizeSpaces(text)
-{
- // IE has already done this conversion, so doing it again will remove multiple nbsp
- if (browserVersion.isIE)
- {
- return text;
- }
-
- // Replace multiple spaces with a single space
- // TODO - this shouldn't occur inside PRE elements
- text = text.replace(/\ +/g, " ");
-
- // Replace with a space
- var nbspPattern = new RegExp(String.fromCharCode(160), "g");
- if (browserVersion.isSafari) {
- return replaceAll(text, String.fromCharCode(160), " ");
- } else {
- return text.replace(nbspPattern, " ");
- }
-}
-
-function replaceAll(text, oldText, newText) {
- while (text.indexOf(oldText) != -1) {
- text = text.replace(oldText, newText);
- }
- return text;
-}
-
-
-function xmlDecode(text) {
- text = text.replace(/"/g, '"');
- text = text.replace(/'/g, "'");
- text = text.replace(/</g, "<");
- text = text.replace(/>/g, ">");
- text = text.replace(/&/g, "&");
- return text;
-}
-
-// Sets the text in this element
-function setText(element, text) {
- if (element.textContent != null) {
- element.textContent = text;
- } else if (element.innerText != null) {
- element.innerText = text;
- }
-}
-
-// Get the value of an element
-function getInputValue(inputElement) {
- if (inputElement.type) {
- if (inputElement.type.toUpperCase() == 'CHECKBOX' ||
- inputElement.type.toUpperCase() == 'RADIO')
- {
- return (inputElement.checked ? 'on' : 'off');
- }
- }
- if (inputElement.value == null) {
- throw new SeleniumError("This element has no value; is it really a form field?");
- }
- return inputElement.value;
-}
-
-/* Fire an event in a browser-compatible manner */
-function triggerEvent(element, eventType, canBubble, controlKeyDown, altKeyDown, shiftKeyDown, metaKeyDown) {
- canBubble = (typeof(canBubble) == undefined) ? true : canBubble;
- if (element.fireEvent && element.ownerDocument && element.ownerDocument.createEventObject) { // IE
- var evt = createEventObject(element, controlKeyDown, altKeyDown, shiftKeyDown, metaKeyDown);
- element.fireEvent('on' + eventType, evt);
- }
- else {
- var evt = document.createEvent('HTMLEvents');
-
- try {
- evt.shiftKey = shiftKeyDown;
- evt.metaKey = metaKeyDown;
- evt.altKey = altKeyDown;
- evt.ctrlKey = controlKeyDown;
- } catch (e) {
- // On Firefox 1.0, you can only set these during initMouseEvent or initKeyEvent
- // we'll have to ignore them here
- LOG.exception(e);
- }
-
- evt.initEvent(eventType, canBubble, true);
- element.dispatchEvent(evt);
- }
-}
-
-function getKeyCodeFromKeySequence(keySequence) {
- var match = /^\\(\d{1,3})$/.exec(keySequence);
- if (match != null) {
- return match[1];
- }
- match = /^.$/.exec(keySequence);
- if (match != null) {
- return match[0].charCodeAt(0);
- }
- // this is for backward compatibility with existing tests
- // 1 digit ascii codes will break however because they are used for the digit chars
- match = /^\d{2,3}$/.exec(keySequence);
- if (match != null) {
- return match[0];
- }
- throw new SeleniumError("invalid keySequence");
-}
-
-function createEventObject(element, controlKeyDown, altKeyDown, shiftKeyDown, metaKeyDown) {
- var evt = element.ownerDocument.createEventObject();
- evt.shiftKey = shiftKeyDown;
- evt.metaKey = metaKeyDown;
- evt.altKey = altKeyDown;
- evt.ctrlKey = controlKeyDown;
- return evt;
-}
-
-function triggerKeyEvent(element, eventType, keySequence, canBubble, controlKeyDown, altKeyDown, shiftKeyDown, metaKeyDown) {
- var keycode = getKeyCodeFromKeySequence(keySequence);
- canBubble = (typeof(canBubble) == undefined) ? true : canBubble;
- if (element.fireEvent && element.ownerDocument && element.ownerDocument.createEventObject) { // IE
- var keyEvent = createEventObject(element, controlKeyDown, altKeyDown, shiftKeyDown, metaKeyDown);
- keyEvent.keyCode = keycode;
- element.fireEvent('on' + eventType, keyEvent);
- }
- else {
- var evt;
- if (window.KeyEvent) {
- evt = document.createEvent('KeyEvents');
- evt.initKeyEvent(eventType, true, true, window, controlKeyDown, altKeyDown, shiftKeyDown, metaKeyDown, keycode, keycode);
- } else {
- evt = document.createEvent('UIEvents');
-
- evt.shiftKey = shiftKeyDown;
- evt.metaKey = metaKeyDown;
- evt.altKey = altKeyDown;
- evt.ctrlKey = controlKeyDown;
-
- evt.initUIEvent(eventType, true, true, window, 1);
- evt.keyCode = keycode;
- evt.which = keycode;
- }
-
- element.dispatchEvent(evt);
- }
-}
-
-function removeLoadListener(element, command) {
- LOG.debug('Removing loadListenter for ' + element + ', ' + command);
- if (window.removeEventListener)
- element.removeEventListener("load", command, true);
- else if (window.detachEvent)
- element.detachEvent("onload", command);
-}
-
-function addLoadListener(element, command) {
- LOG.debug('Adding loadListenter for ' + element + ', ' + command);
- var augmentedCommand = function() {
- command.call(this, element);
- }
- if (window.addEventListener && !browserVersion.isOpera)
- element.addEventListener("load", augmentedCommand, true);
- else if (window.attachEvent)
- element.attachEvent("onload", augmentedCommand);
-}
-
-/**
- * Override the broken getFunctionName() method from JsUnit
- * This file must be loaded _after_ the jsunitCore.js
- */
-function getFunctionName(aFunction) {
- var regexpResult = aFunction.toString().match(/function (\w*)/);
- if (regexpResult && regexpResult[1]) {
- return regexpResult[1];
- }
- return 'anonymous';
-}
-
-function getDocumentBase(doc) {
- var bases = document.getElementsByTagName("base");
- if (bases && bases.length && bases[0].href) {
- return bases[0].href;
- }
- return "";
-}
-
-function getTagName(element) {
- var tagName;
- if (element && element.tagName && element.tagName.toLowerCase) {
- tagName = element.tagName.toLowerCase();
- }
- return tagName;
-}
-
-function selArrayToString(a) {
- if (isArray(a)) {
- // DGF copying the array, because the array-like object may be a non-modifiable nodelist
- var retval = [];
- for (var i = 0; i < a.length; i++) {
- var item = a[i];
- var replaced = new String(item).replace(/([,\\])/g, '\\$1');
- retval[i] = replaced;
- }
- return retval;
- }
- return new String(a);
-}
-
-
-function isArray(x) {
- return ((typeof x) == "object") && (x["length"] != null);
-}
-
-function absolutify(url, baseUrl) {
- /** returns a relative url in its absolute form, given by baseUrl.
- *
- * This function is a little odd, because it can take baseUrls that
- * aren't necessarily directories. It uses the same rules as the HTML
- * <base> tag; if the baseUrl doesn't end with "/", we'll assume
- * that it points to a file, and strip the filename off to find its
- * base directory.
- *
- * So absolutify("foo", "http://x/bar") will return "http://x/foo" (stripping off bar),
- * whereas absolutify("foo", "http://x/bar/") will return "http://x/bar/foo" (preserving bar).
- * Naturally absolutify("foo", "http://x") will return "http://x/foo", appropriately.
- *
- * @param url the url to make absolute; if this url is already absolute, we'll just return that, unchanged
- * @param baseUrl the baseUrl from which we'll absolutify, following the rules above.
- * @return 'url' if it was already absolute, or the absolutized version of url if it was not absolute.
- */
-
- // DGF isn't there some library we could use for this?
-
- if (/^\w+:/.test(url)) {
- // it's already absolute
- return url;
- }
-
- var loc;
- try {
- loc = parseUrl(baseUrl);
- } catch (e) {
- // is it an absolute windows file path? let's play the hero in that case
- if (/^\w:\\/.test(baseUrl)) {
- baseUrl = "file:///" + baseUrl.replace(/\\/g, "/");
- loc = parseUrl(baseUrl);
- } else {
- throw new SeleniumError("baseUrl wasn't absolute: " + baseUrl);
- }
- }
- loc.search = null;
- loc.hash = null;
-
- // if url begins with /, then that's the whole pathname
- if (/^\//.test(url)) {
- loc.pathname = url;
- var result = reassembleLocation(loc);
- return result;
- }
-
- // if pathname is null, then we'll just append "/" + the url
- if (!loc.pathname) {
- loc.pathname = "/" + url;
- var result = reassembleLocation(loc);
- return result;
- }
-
- // if pathname ends with /, just append url
- if (/\/$/.test(loc.pathname)) {
- loc.pathname += url;
- var result = reassembleLocation(loc);
- return result;
- }
-
- // if we're here, then the baseUrl has a pathname, but it doesn't end with /
- // in that case, we replace everything after the final / with the relative url
- loc.pathname = loc.pathname.replace(/[^\/\\]+$/, url);
- var result = reassembleLocation(loc);
- return result;
-
-}
-
-var URL_REGEX = /^((\w+):\/\/)(([^:]+):?([^@]+)?@)?([^\/\?:]*):?(\d+)?(\/?[^\?#]+)?\??([^#]+)?#?(.+)?/;
-
-function parseUrl(url) {
- var fields = ['url', null, 'protocol', null, 'username', 'password', 'host', 'port', 'pathname', 'search', 'hash'];
- var result = URL_REGEX.exec(url);
- if (!result) {
- throw new SeleniumError("Invalid URL: " + url);
- }
- var loc = new Object();
- for (var i = 0; i < fields.length; i++) {
- var field = fields[i];
- if (field == null) {
- continue;
- }
- loc[field] = result[i];
- }
- return loc;
-}
-
-function reassembleLocation(loc) {
- if (!loc.protocol) {
- throw new Error("Not a valid location object: " + o2s(loc));
- }
- var protocol = loc.protocol;
- protocol = protocol.replace(/:$/, "");
- var url = protocol + "://";
- if (loc.username) {
- url += loc.username;
- if (loc.password) {
- url += ":" + loc.password;
- }
- url += "@";
- }
- if (loc.host) {
- url += loc.host;
- }
-
- if (loc.port) {
- url += ":" + loc.port;
- }
-
- if (loc.pathname) {
- url += loc.pathname;
- }
-
- if (loc.search) {
- url += "?" + loc.search;
- }
- if (loc.hash) {
- var hash = loc.hash;
- hash = loc.hash.replace(/^#/, "");
- url += "#" + hash;
- }
- return url;
-}
-
-function canonicalize(url) {
- if(url == "about:blank")
- {
- return url;
- }
- var tempLink = window.document.createElement("link");
- tempLink.href = url; // this will canonicalize the href on most browsers
- var loc = parseUrl(tempLink.href)
- if (!/\/\.\.\//.test(loc.pathname)) {
- return tempLink.href;
- }
- // didn't work... let's try it the hard way
- var originalParts = loc.pathname.split("/");
- var newParts = [];
- newParts.push(originalParts.shift());
- for (var i = 0; i < originalParts.length; i++) {
- var part = originalParts[i];
- if (".." == part) {
- newParts.pop();
- continue;
- }
- newParts.push(part);
- }
- loc.pathname = newParts.join("/");
- return reassembleLocation(loc);
-}
-
-function extractExceptionMessage(ex) {
- if (ex == null) return "null exception";
- if (ex.message != null) return ex.message;
- if (ex.toString && ex.toString() != null) return ex.toString();
-}
-
-
-function describe(object, delimiter) {
- var props = new Array();
- for (var prop in object) {
- try {
- props.push(prop + " -> " + object[prop]);
- } catch (e) {
- props.push(prop + " -> [htmlutils: ack! couldn't read this property! (Permission Denied?)]");
- }
- }
- return props.join(delimiter || '\n');
-}
-
-var PatternMatcher = function(pattern) {
- this.selectStrategy(pattern);
-};
-PatternMatcher.prototype = {
-
- selectStrategy: function(pattern) {
- this.pattern = pattern;
- var strategyName = 'glob';
- // by default
- if (/^([a-z-]+):(.*)/.test(pattern)) {
- var possibleNewStrategyName = RegExp.$1;
- var possibleNewPattern = RegExp.$2;
- if (PatternMatcher.strategies[possibleNewStrategyName]) {
- strategyName = possibleNewStrategyName;
- pattern = possibleNewPattern;
- }
- }
- var matchStrategy = PatternMatcher.strategies[strategyName];
- if (!matchStrategy) {
- throw new SeleniumError("cannot find PatternMatcher.strategies." + strategyName);
- }
- this.strategy = matchStrategy;
- this.matcher = new matchStrategy(pattern);
- },
-
- matches: function(actual) {
- return this.matcher.matches(actual + '');
- // Note: appending an empty string avoids a Konqueror bug
- }
-
-};
-
-/**
- * A "static" convenience method for easy matching
- */
-PatternMatcher.matches = function(pattern, actual) {
- return new PatternMatcher(pattern).matches(actual);
-};
-
-PatternMatcher.strategies = {
-
-/**
- * Exact matching, e.g. "exact:***"
- */
- exact: function(expected) {
- this.expected = expected;
- this.matches = function(actual) {
- return actual == this.expected;
- };
- },
-
-/**
- * Match by regular expression, e.g. "regexp:^[0-9]+$"
- */
- regexp: function(regexpString) {
- this.regexp = new RegExp(regexpString);
- this.matches = function(actual) {
- return this.regexp.test(actual);
- };
- },
-
- regex: function(regexpString) {
- this.regexp = new RegExp(regexpString);
- this.matches = function(actual) {
- return this.regexp.test(actual);
- };
- },
-
- regexpi: function(regexpString) {
- this.regexp = new RegExp(regexpString, "i");
- this.matches = function(actual) {
- return this.regexp.test(actual);
- };
- },
-
- regexi: function(regexpString) {
- this.regexp = new RegExp(regexpString, "i");
- this.matches = function(actual) {
- return this.regexp.test(actual);
- };
- },
-
-/**
- * "globContains" (aka "wildmat") patterns, e.g. "glob:one,two,*",
- * but don't require a perfect match; instead succeed if actual
- * contains something that matches globString.
- * Making this distinction is motivated by a bug in IE6 which
- * leads to the browser hanging if we implement *TextPresent tests
- * by just matching against a regular expression beginning and
- * ending with ".*". The globcontains strategy allows us to satisfy
- * the functional needs of the *TextPresent ops more efficiently
- * and so avoid running into this IE6 freeze.
- */
- globContains: function(globString) {
- this.regexp = new RegExp(PatternMatcher.regexpFromGlobContains(globString));
- this.matches = function(actual) {
- return this.regexp.test(actual);
- };
- },
-
-
-/**
- * "glob" (aka "wildmat") patterns, e.g. "glob:one,two,*"
- */
- glob: function(globString) {
- this.regexp = new RegExp(PatternMatcher.regexpFromGlob(globString));
- this.matches = function(actual) {
- return this.regexp.test(actual);
- };
- }
-
-};
-
-PatternMatcher.convertGlobMetaCharsToRegexpMetaChars = function(glob) {
- var re = glob;
- re = re.replace(/([.^$+(){}\[\]\\|])/g, "\\$1");
- re = re.replace(/\?/g, "(.|[\r\n])");
- re = re.replace(/\*/g, "(.|[\r\n])*");
- return re;
-};
-
-PatternMatcher.regexpFromGlobContains = function(globContains) {
- return PatternMatcher.convertGlobMetaCharsToRegexpMetaChars(globContains);
-};
-
-PatternMatcher.regexpFromGlob = function(glob) {
- return "^" + PatternMatcher.convertGlobMetaCharsToRegexpMetaChars(glob) + "$";
-};
-
-if (!this["Assert"]) Assert = {};
-
-
-Assert.fail = function(message) {
- throw new AssertionFailedError(message);
-};
-
-/*
-* Assert.equals(comment?, expected, actual)
-*/
-Assert.equals = function() {
- var args = new AssertionArguments(arguments);
- if (args.expected === args.actual) {
- return;
- }
- Assert.fail(args.comment +
- "Expected '" + args.expected +
- "' but was '" + args.actual + "'");
-};
-
-Assert.assertEquals = Assert.equals;
-
-/*
-* Assert.matches(comment?, pattern, actual)
-*/
-Assert.matches = function() {
- var args = new AssertionArguments(arguments);
- if (PatternMatcher.matches(args.expected, args.actual)) {
- return;
- }
- Assert.fail(args.comment +
- "Actual value '" + args.actual +
- "' did not match '" + args.expected + "'");
-}
-
-/*
-* Assert.notMtches(comment?, pattern, actual)
-*/
-Assert.notMatches = function() {
- var args = new AssertionArguments(arguments);
- if (!PatternMatcher.matches(args.expected, args.actual)) {
- return;
- }
- Assert.fail(args.comment +
- "Actual value '" + args.actual +
- "' did match '" + args.expected + "'");
-}
-
-
-// Preprocess the arguments to allow for an optional comment.
-function AssertionArguments(args) {
- if (args.length == 2) {
- this.comment = "";
- this.expected = args[0];
- this.actual = args[1];
- } else {
- this.comment = args[0] + "; ";
- this.expected = args[1];
- this.actual = args[2];
- }
-}
-
-function AssertionFailedError(message) {
- this.isAssertionFailedError = true;
- this.isSeleniumError = true;
- this.message = message;
- this.failureMessage = message;
-}
-
-function SeleniumError(message) {
- var error = new Error(message);
- if (typeof(arguments.caller) != 'undefined') { // IE, not ECMA
- var result = '';
- for (var a = arguments.caller; a != null; a = a.caller) {
- result += '> ' + a.callee.toString() + '\n';
- if (a.caller == a) {
- result += '*';
- break;
- }
- }
- error.stack = result;
- }
- error.isSeleniumError = true;
- return error;
-}
-
-function highlight(element) {
- var highLightColor = "yellow";
- if (element.originalColor == undefined) { // avoid picking up highlight
- element.originalColor = elementGetStyle(element, "background-color");
- }
- elementSetStyle(element, {"backgroundColor" : highLightColor});
- window.setTimeout(function() {
- try {
- //if element is orphan, probably page of it has already gone, so ignore
- if (!element.parentNode) {
- return;
- }
- elementSetStyle(element, {"backgroundColor" : element.originalColor});
- } catch (e) {} // DGF unhighlighting is very dangerous and low priority
- }, 200);
-}
-
-
-
-// for use from vs.2003 debugger
-function o2s(obj) {
- var s = "";
- for (key in obj) {
- var line = key + "->" + obj[key];
- line.replace("\n", " ");
- s += line + "\n";
- }
- return s;
-}
-
-var seenReadyStateWarning = false;
-
-function openSeparateApplicationWindow(url, suppressMozillaWarning) {
- // resize the Selenium window itself
- window.resizeTo(1200, 500);
- window.moveTo(window.screenX, 0);
-
- var appWindow = window.open(url + '?start=true', 'main');
- if (appWindow == null) {
- var errorMessage = "Couldn't open app window; is the pop-up blocker enabled?"
- LOG.error(errorMessage);
- throw new Error("Couldn't open app window; is the pop-up blocker enabled?");
- }
- try {
- var windowHeight = 500;
- if (window.outerHeight) {
- windowHeight = window.outerHeight;
- } else if (document.documentElement && document.documentElement.offsetHeight) {
- windowHeight = document.documentElement.offsetHeight;
- }
-
- if (window.screenLeft && !window.screenX) window.screenX = window.screenLeft;
- if (window.screenTop && !window.screenY) window.screenY = window.screenTop;
-
- appWindow.resizeTo(1200, screen.availHeight - windowHeight - 60);
- appWindow.moveTo(window.screenX, window.screenY + windowHeight + 25);
- } catch (e) {
- LOG.error("Couldn't resize app window");
- LOG.exception(e);
- }
-
-
- if (!suppressMozillaWarning && window.document.readyState == null && !seenReadyStateWarning) {
- alert("Beware! Mozilla bug 300992 means that we can't always reliably detect when a new page has loaded. Install the Selenium IDE extension or the readyState extension available from selenium.openqa.org to make page load detection more reliable.");
- seenReadyStateWarning = true;
- }
-
- return appWindow;
-}
-
-var URLConfiguration = classCreate();
-objectExtend(URLConfiguration.prototype, {
- initialize: function() {
- },
- _isQueryParameterTrue: function (name) {
- var parameterValue = this._getQueryParameter(name);
- if (parameterValue == null) return false;
- if (parameterValue.toLowerCase() == "true") return true;
- if (parameterValue.toLowerCase() == "on") return true;
- return false;
- },
-
- _getQueryParameter: function(searchKey) {
- var str = this.queryString
- if (str == null) return null;
- var clauses = str.split('&');
- for (var i = 0; i < clauses.length; i++) {
- var keyValuePair = clauses[i].split('=', 2);
- var key = unescape(keyValuePair[0]);
- if (key == searchKey) {
- return unescape(keyValuePair[1]);
- }
- }
- return null;
- },
-
- _extractArgs: function() {
- var str = SeleniumHTARunner.commandLine;
- if (str == null || str == "") return new Array();
- var matches = str.match(/(?:\"([^\"]+)\"|(?!\"([^\"]+)\")(\S+))/g);
- // We either want non quote stuff ([^"]+) surrounded by quotes
- // or we want to look-ahead, see that the next character isn't
- // a quoted argument, and then grab all the non-space stuff
- // this will return for the line: "foo" bar
- // the results "\"foo\"" and "bar"
-
- // So, let's unquote the quoted arguments:
- var args = new Array;
- for (var i = 0; i < matches.length; i++) {
- args[i] = matches[i];
- args[i] = args[i].replace(/^"(.*)"$/, "$1");
- }
- return args;
- },
-
- isMultiWindowMode:function() {
- return this._isQueryParameterTrue('multiWindow');
- },
-
- getBaseUrl:function() {
- return this._getQueryParameter('baseUrl');
-
- }
-});
-
-
-function safeScrollIntoView(element) {
- if (element.scrollIntoView) {
- element.scrollIntoView(false);
- return;
- }
- // TODO: work out how to scroll browsers that don't support
- // scrollIntoView (like Konqueror)
-}
-
-/**
- * Returns the absolute time represented as an offset of the current time.
- * Throws a SeleniumException if timeout is invalid.
- *
- * @param timeout the number of milliseconds from "now" whose absolute time
- * to return
- */
-function getTimeoutTime(timeout) {
- var now = new Date().getTime();
- var timeoutLength = parseInt(timeout);
-
- if (isNaN(timeoutLength)) {
- throw new SeleniumError("Timeout is not a number: '" + timeout + "'");
- }
-
- return now + timeoutLength;
-}
-
-/**
- * Returns true iff the current environment is the IDE.
- */
-function is_IDE()
-{
- return (typeof(SeleniumIDE) != 'undefined');
-}
-
-/**
- * Logs a message if the Logger exists, and does nothing if it doesn't exist.
- *
- * @param level the level to log at
- * @param msg the message to log
- */
-function safe_log(level, msg)
-{
- try {
- LOG[level](msg);
- }
- catch (e) {
- // couldn't log!
- }
-}
-
-/**
- * Displays a warning message to the user appropriate to the context under
- * which the issue is encountered. This is primarily used to avoid popping up
- * alert dialogs that might pause an automated test suite.
- *
- * @param msg the warning message to display
- */
-function safe_alert(msg)
-{
- if (is_IDE()) {
- alert(msg);
- }
-}
-
-/**
- * Returns true iff the given element represents a link with a javascript
- * href attribute, and does not have an onclick attribute defined.
- *
- * @param element the element to test
- */
-function hasJavascriptHref(element) {
- if (getTagName(element) != 'a') {
- return false;
- }
- if (element.onclick) {
- return false;
- }
- if (! element.href) {
- return false;
- }
- if (! /\s*javascript:/i.test(element.href)) {
- return false;
- }
- return true;
-}
-
-/**
- * Returns the given element, or its nearest ancestor, that satisfies
- * hasJavascriptHref(). Returns null if none is found.
- *
- * @param element the element whose ancestors to test
- */
-function getAncestorOrSelfWithJavascriptHref(element) {
- if (hasJavascriptHref(element)) {
- return element;
- }
- if (element.parentNode == null) {
- return null;
- }
- return getAncestorOrSelfWithJavascriptHref(element.parentNode);
-}
-
-//******************************************************************************
-// Locator evaluation support
-
-/**
- * Parses a Selenium locator, returning its type and the unprefixed locator
- * string as an object.
- *
- * @param locator the locator to parse
- */
-function parse_locator(locator)
-{
- var result = locator.match(/^([A-Za-z]+)=(.+)/);
- if (result) {
- return { type: result[1].toLowerCase(), string: result[2] };
- }
- return { type: 'implicit', string: locator };
-}
-
-/**
- * Evaluates an xpath on a document, and returns a list containing nodes in the
- * resulting nodeset. The browserbot xpath methods are now backed by this
- * function. A context node may optionally be provided, and the xpath will be
- * evaluated from that context.
- *
- * @param xpath the xpath to evaluate
- * @param inDocument the document in which to evaluate the xpath.
- * @param opts (optional) An object containing various flags that can
- * modify how the xpath is evaluated. Here's a listing of
- * the meaningful keys:
- *
- * contextNode:
- * the context node from which to evaluate the xpath. If
- * unspecified, the context will be the root document
- * element.
- *
- * namespaceResolver:
- * the namespace resolver function. Defaults to null.
- *
- * xpathLibrary:
- * the javascript library to use for XPath. "ajaxslt" is
- * the default. "javascript-xpath" is newer and faster,
- * but needs more testing.
- *
- * allowNativeXpath:
- * whether to allow native evaluate(). Defaults to true.
- *
- * ignoreAttributesWithoutValue:
- * whether it's ok to ignore attributes without value
- * when evaluating the xpath. This can greatly improve
- * performance in IE; however, if your xpaths depend on
- * such attributes, you can't ignore them! Defaults to
- * true.
- *
- * returnOnFirstMatch:
- * whether to optimize the XPath evaluation to only
- * return the first match. The match, if any, will still
- * be returned in a list. Defaults to false.
- */
-function eval_xpath(xpath, inDocument, opts)
-{
- if (!opts) {
- var opts = {};
- }
- var contextNode = opts.contextNode
- ? opts.contextNode : inDocument;
- var namespaceResolver = opts.namespaceResolver
- ? opts.namespaceResolver : null;
- var xpathLibrary = opts.xpathLibrary
- ? opts.xpathLibrary : null;
- var allowNativeXpath = (opts.allowNativeXpath != undefined)
- ? opts.allowNativeXpath : true;
- var ignoreAttributesWithoutValue = (opts.ignoreAttributesWithoutValue != undefined)
- ? opts.ignoreAttributesWithoutValue : true;
- var returnOnFirstMatch = (opts.returnOnFirstMatch != undefined)
- ? opts.returnOnFirstMatch : false;
-
- // Trim any trailing "/": not valid xpath, and remains from attribute
- // locator.
- if (xpath.charAt(xpath.length - 1) == '/') {
- xpath = xpath.slice(0, -1);
- }
- // HUGE hack - remove namespace from xpath for IE
- if (browserVersion && browserVersion.isIE) {
- xpath = xpath.replace(/x:/g, '')
- }
-
- var nativeXpathAvailable = inDocument.evaluate;
- var useNativeXpath = allowNativeXpath && nativeXpathAvailable;
- var useDocumentEvaluate = useNativeXpath;
-
- // When using the new and faster javascript-xpath library,
- // we'll use the TestRunner's document object, not the App-Under-Test's document.
- // The new library only modifies the TestRunner document with the new
- // functionality.
- if (xpathLibrary == 'javascript-xpath' && !useNativeXpath) {
- documentForXpath = document;
- useDocumentEvaluate = true;
- } else {
- documentForXpath = inDocument;
- }
- var results = [];
-
- // this is either native xpath or javascript-xpath via TestRunner.evaluate
- if (useDocumentEvaluate) {
- try {
- // Regarding use of the second argument to document.evaluate():
- // http://groups.google.com/group/comp.lang.javascript/browse_thread/thread/a59ce20639c74ba1/a9d9f53e88e5ebb5
- var xpathResult = documentForXpath
- .evaluate((contextNode == inDocument ? xpath : '.' + xpath),
- contextNode, namespaceResolver, 0, null);
- }
- catch (e) {
- throw new SeleniumError("Invalid xpath: " + extractExceptionMessage(e));
- }
- finally{
- if (xpathResult == null) {
- // If the result is null, we should still throw an Error.
- throw new SeleniumError("Invalid xpath: " + xpath);
- }
- }
- var result = xpathResult.iterateNext();
- while (result) {
- results.push(result);
- result = xpathResult.iterateNext();
- }
- return results;
- }
-
- // If not, fall back to slower JavaScript implementation
- // DGF set xpathdebug = true (using getEval, if you like) to turn on JS XPath debugging
- //xpathdebug = true;
- var context;
- if (contextNode == inDocument) {
- context = new ExprContext(inDocument);
- }
- else {
- // provide false values to get the default constructor values
- context = new ExprContext(contextNode, false, false,
- contextNode.parentNode);
- }
- context.setCaseInsensitive(true);
- context.setIgnoreAttributesWithoutValue(ignoreAttributesWithoutValue);
- context.setReturnOnFirstMatch(returnOnFirstMatch);
- var xpathObj;
- try {
- xpathObj = xpathParse(xpath);
- }
- catch (e) {
- throw new SeleniumError("Invalid xpath: " + extractExceptionMessage(e));
- }
- var xpathResult = xpathObj.evaluate(context);
- if (xpathResult && xpathResult.value) {
- for (var i = 0; i < xpathResult.value.length; ++i) {
- results.push(xpathResult.value[i]);
- }
- }
- return results;
-}
-
-/**
- * Returns the full resultset of a CSS selector evaluation.
- */
-function eval_css(locator, inDocument)
-{
- return cssQuery(locator, inDocument);
-}
-
-/**
- * This function duplicates part of BrowserBot.findElement() to open up locator
- * evaluation on arbitrary documents. It returns a plain old array of located
- * elements found by using a Selenium locator.
- *
- * Multiple results may be generated for xpath and CSS locators. Even though a
- * list could potentially be generated for other locator types, such as link,
- * we don't try for them, because they aren't very expressive location
- * strategies; if you want a list, use xpath or CSS. Furthermore, strategies
- * for these locators have been optimized to only return the first result. For
- * these types of locators, performance is more important than ideal behavior.
- *
- * @param locator a locator string
- * @param inDocument the document in which to apply the locator
- * @param opt_contextNode the context within which to evaluate the locator
- *
- * @return a list of result elements
- */
-function eval_locator(locator, inDocument, opt_contextNode)
-{
- locator = parse_locator(locator);
-
- var pageBot;
- if (typeof(selenium) != 'undefined' && selenium != undefined) {
- if (typeof(editor) == 'undefined' || editor.state == 'playing') {
- safe_log('info', 'Trying [' + locator.type + ']: '
- + locator.string);
- }
- pageBot = selenium.browserbot;
- }
- else {
- if (!UI_GLOBAL.mozillaBrowserBot) {
- // create a browser bot to evaluate the locator. Hand it the IDE
- // window as a dummy window, and cache it for future use.
- UI_GLOBAL.mozillaBrowserBot = new MozillaBrowserBot(window)
- }
- pageBot = UI_GLOBAL.mozillaBrowserBot;
- }
-
- var results = [];
-
- if (locator.type == 'xpath' || (locator.string.charAt(0) == '/' &&
- locator.type == 'implicit')) {
- results = eval_xpath(locator.string, inDocument,
- { contextNode: opt_contextNode });
- }
- else if (locator.type == 'css') {
- results = eval_css(locator.string, inDocument);
- }
- else {
- var element = pageBot
- .findElementBy(locator.type, locator.string, inDocument);
- if (element != null) {
- results.push(element);
- }
- }
-
- return results;
-}
-
-//******************************************************************************
-// UI-Element
-
-/**
- * Escapes the special regular expression characters in a string intended to be
- * used as a regular expression.
- *
- * Based on: http://simonwillison.net/2006/Jan/20/escape/
- */
-RegExp.escape = (function() {
- var specials = [
- '/', '.', '*', '+', '?', '|', '^', '$',
- '(', ')', '[', ']', '{', '}', '\\'
- ];
-
- var sRE = new RegExp(
- '(\\' + specials.join('|\\') + ')', 'g'
- );
-
- return function(text) {
- return text.replace(sRE, '\\$1');
- }
-})();
-
-/**
- * Returns true if two arrays are identical, and false otherwise.
- *
- * @param a1 the first array, may only contain simple values (strings or
- * numbers)
- * @param a2 the second array, same restricts on data as for a1
- * @return true if the arrays are equivalent, false otherwise.
- */
-function are_equal(a1, a2)
-{
- if (typeof(a1) != typeof(a2))
- return false;
-
- switch(typeof(a1)) {
- case 'object':
- // arrays
- if (a1.length) {
- if (a1.length != a2.length)
- return false;
- for (var i = 0; i < a1.length; ++i) {
- if (!are_equal(a1[i], a2[i]))
- return false
- }
- }
- // associative arrays
- else {
- var keys = {};
- for (var key in a1) {
- keys[key] = true;
- }
- for (var key in a2) {
- keys[key] = true;
- }
- for (var key in keys) {
- if (!are_equal(a1[key], a2[key]))
- return false;
- }
- }
- return true;
-
- default:
- return a1 == a2;
- }
-}
-
-
-/**
- * Create a clone of an object and return it. This is a deep copy of everything
- * but functions, whose references are copied. You shouldn't expect a deep copy
- * of functions anyway.
- *
- * @param orig the original object to copy
- * @return a deep copy of the original object. Any functions attached,
- * however, will have their references copied only.
- */
-function clone(orig) {
- var copy;
- switch(typeof(orig)) {
- case 'object':
- copy = (orig.length) ? [] : {};
- for (var attr in orig) {
- copy[attr] = clone(orig[attr]);
- }
- break;
- default:
- copy = orig;
- break;
- }
- return copy;
-}
-
-/**
- * Emulates php's print_r() functionality. Returns a nicely formatted string
- * representation of an object. Very useful for debugging.
- *
- * @param object the object to dump
- * @param maxDepth the maximum depth to recurse into the object. Ellipses will
- * be shown for objects whose depth exceeds the maximum.
- * @param indent the string to use for indenting progressively deeper levels
- * of the dump.
- * @return a string representing a dump of the object
- */
-function print_r(object, maxDepth, indent)
-{
- var parentIndent, attr, str = "";
- if (arguments.length == 1) {
- var maxDepth = Number.MAX_VALUE;
- } else {
- maxDepth--;
- }
- if (arguments.length < 3) {
- parentIndent = ''
- var indent = ' ';
- } else {
- parentIndent = indent;
- indent += ' ';
- }
-
- switch(typeof(object)) {
- case 'object':
- if (object.length != undefined) {
- if (object.length == 0) {
- str += "Array ()\r\n";
- }
- else {
- str += "Array (\r\n";
- for (var i = 0; i < object.length; ++i) {
- str += indent + '[' + i + '] => ';
- if (maxDepth == 0)
- str += "...\r\n";
- else
- str += print_r(object[i], maxDepth, indent);
- }
- str += parentIndent + ")\r\n";
- }
- }
- else {
- str += "Object (\r\n";
- for (attr in object) {
- str += indent + "[" + attr + "] => ";
- if (maxDepth == 0)
- str += "...\r\n";
- else
- str += print_r(object[attr], maxDepth, indent);
- }
- str += parentIndent + ")\r\n";
- }
- break;
- case 'boolean':
- str += (object ? 'true' : 'false') + "\r\n";
- break;
- case 'function':
- str += "Function\r\n";
- break;
- default:
- str += object + "\r\n";
- break;
-
- }
- return str;
-}
-
-/**
- * Return an array containing all properties of an object. Perl-style.
- *
- * @param object the object whose keys to return
- * @return array of object keys, as strings
- */
-function keys(object)
-{
- var keys = [];
- for (var k in object) {
- keys.push(k);
- }
- return keys;
-}
-
-/**
- * Emulates python's range() built-in. Returns an array of integers, counting
- * up (or down) from start to end. Note that the range returned is up to, but
- * NOT INCLUDING, end.
- *.
- * @param start integer from which to start counting. If the end parameter is
- * not provided, this value is considered the end and start will
- * be zero.
- * @param end integer to which to count. If omitted, the function will count
- * up from zero to the value of the start parameter. Note that
- * the array returned will count up to but will not include this
- * value.
- * @return an array of consecutive integers.
- */
-function range(start, end)
-{
- if (arguments.length == 1) {
- var end = start;
- start = 0;
- }
-
- var r = [];
- if (start < end) {
- while (start != end)
- r.push(start++);
- }
- else {
- while (start != end)
- r.push(start--);
- }
- return r;
-}
-
-/**
- * Parses a python-style keyword arguments string and returns the pairs in a
- * new object.
- *
- * @param kwargs a string representing a set of keyword arguments. It should
- * look like keyword1=value1, keyword2=value2, ...
- * @return an object mapping strings to strings
- */
-function parse_kwargs(kwargs)
-{
- var args = new Object();
- var pairs = kwargs.split(/,/);
- for (var i = 0; i < pairs.length;) {
- if (i > 0 && pairs[i].indexOf('=') == -1) {
- // the value string contained a comma. Glue the parts back together.
- pairs[i-1] += ',' + pairs.splice(i, 1)[0];
- }
- else {
- ++i;
- }
- }
- for (var i = 0; i < pairs.length; ++i) {
- var splits = pairs[i].split(/=/);
- if (splits.length == 1) {
- continue;
- }
- var key = splits.shift();
- var value = splits.join('=');
- args[key.trim()] = value.trim();
- }
- return args;
-}
-
-/**
- * Creates a python-style keyword arguments string from an object.
- *
- * @param args an associative array mapping strings to strings
- * @param sortedKeys (optional) a list of keys of the args parameter that
- * specifies the order in which the arguments will appear in
- * the returned kwargs string
- *
- * @return a kwarg string representation of args
- */
-function to_kwargs(args, sortedKeys)
-{
- var s = '';
- if (!sortedKeys) {
- var sortedKeys = keys(args).sort();
- }
- for (var i = 0; i < sortedKeys.length; ++i) {
- var k = sortedKeys[i];
- if (args[k] != undefined) {
- if (s) {
- s += ', ';
- }
- s += k + '=' + args[k];
- }
- }
- return s;
-}
-
-/**
- * Returns true if a node is an ancestor node of a target node, and false
- * otherwise.
- *
- * @param node the node being compared to the target node
- * @param target the target node
- * @return true if node is an ancestor node of target, false otherwise.
- */
-function is_ancestor(node, target)
-{
- while (target.parentNode) {
- target = target.parentNode;
- if (node == target)
- return true;
- }
- return false;
-}
-
-//******************************************************************************
-// parseUri 1.2.1
-// MIT License
-
-/*
-Copyright (c) 2007 Steven Levithan
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-*/
-
-function parseUri (str) {
- var o = parseUri.options,
- m = o.parser[o.strictMode ? "strict" : "loose"].exec(str),
- uri = {},
- i = 14;
-
- while (i--) uri[o.key[i]] = m[i] || "";
-
- uri[o.q.name] = {};
- uri[o.key[12]].replace(o.q.parser, function ($0, $1, $2) {
- if ($1) uri[o.q.name][$1] = $2;
- });
-
- return uri;
-};
-
-parseUri.options = {
- strictMode: false,
- key: ["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],
- q: {
- name: "queryKey",
- parser: /(?:^|&)([^&=]*)=?([^&]*)/g
- },
- parser: {
- strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,
- loose: /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/
- }
-};
-
diff --git a/vendor/plugins/selenium-on-rails/selenium-core/scripts/injection.html b/vendor/plugins/selenium-on-rails/selenium-core/scripts/injection.html
deleted file mode 100644
index 546e7500..00000000
--- a/vendor/plugins/selenium-on-rails/selenium-core/scripts/injection.html
+++ /dev/null
@@ -1,72 +0,0 @@
-
diff --git a/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-api.js b/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-api.js
deleted file mode 100644
index b55265f8..00000000
--- a/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-api.js
+++ /dev/null
@@ -1,3184 +0,0 @@
-/*
- * Copyright 2004 ThoughtWorks, Inc
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// TODO: stop navigating this.browserbot.document() ... it breaks encapsulation
-
-var storedVars = new Object();
-
-function Selenium(browserbot) {
- /**
- * Defines an object that runs Selenium commands.
- *
- * Element Locators
- *
- * Element Locators tell Selenium which HTML element a command refers to.
- * The format of a locator is:
- *
- * locatorType=argument
- *
- *
- *
- * We support the following strategies for locating elements:
- *
- *
- *
- * - identifier=id:
- * Select the element with the specified @id attribute. If no match is
- * found, select the first element whose @name attribute is id.
- * (This is normally the default; see below.)
- * - id=id:
- * Select the element with the specified @id attribute.
- *
- * - name=name:
- * Select the first element with the specified @name attribute.
- *
- * - username
- * - name=username
- *
- *
- * The name may optionally be followed by one or more element-filters, separated from the name by whitespace. If the filterType is not specified, value is assumed.
- *
- *
- * - name=flavour value=chocolate
- *
- *
- * - dom=javascriptExpression:
- *
- * Find an element by evaluating the specified string. This allows you to traverse the HTML Document Object
- * Model using JavaScript. Note that you must not return a value in this string; simply make it the last expression in the block.
- *
- * - dom=document.forms['myForm'].myDropdown
- * - dom=document.images[56]
- * - dom=function foo() { return document.links[1]; }; foo();
- *
- *
- *
- *
- * - xpath=xpathExpression:
- * Locate an element using an XPath expression.
- *
- * - xpath=//img[@alt='The image alt text']
- * - xpath=//table[@id='table1']//tr[4]/td[2]
- * - xpath=//a[contains(@href,'#id1')]
- * - xpath=//a[contains(@href,'#id1')]/@class
- * - xpath=(//table[@class='stylee'])//th[text()='theHeaderText']/../td
- * - xpath=//input[@name='name2' and @value='yes']
- * - xpath=//*[text()="right"]
- *
- *
- *
- * - link=textPattern:
- * Select the link (anchor) element which contains text matching the
- * specified pattern.
- *
- * - link=The link text
- *
- *
- *
- *
- * - css=cssSelectorSyntax:
- * Select the element using css selectors. Please refer to CSS2 selectors, CSS3 selectors for more information. You can also check the TestCssLocators test in the selenium test suite for an example of usage, which is included in the downloaded selenium core package.
- *
- * - css=a[href="#id3"]
- * - css=span#firstChild + span
- *
- * Currently the css selector locator supports all css1, css2 and css3 selectors except namespace in css3, some pseudo classes(:nth-of-type, :nth-last-of-type, :first-of-type, :last-of-type, :only-of-type, :visited, :hover, :active, :focus, :indeterminate) and pseudo elements(::first-line, ::first-letter, ::selection, ::before, ::after).
- *
- *
- * - ui=uiSpecifierString:
- * Locate an element by resolving the UI specifier string to another locator, and evaluating it. See the Selenium UI-Element Reference for more details.
- *
- * - ui=loginPages::loginButton()
- * - ui=settingsPages::toggle(label=Hide Email)
- * - ui=forumPages::postBody(index=2)//a[2]
- *
- *
- *
- *
- *
- *
- * Without an explicit locator prefix, Selenium uses the following default
- * strategies:
- *
- *
- *
- * - dom, for locators starting with "document."
- * - xpath, for locators starting with "//"
- * - identifier, otherwise
- *
- *
- *
- *
- * Element filters can be used with a locator to refine a list of candidate elements. They are currently used only in the 'name' element-locator.
- * Filters look much like locators, ie.
- *
- * filterType=argument
- *
- * Supported element-filters are:
- * value=valuePattern
- *
- * Matches elements based on their values. This is particularly useful for refining a list of similarly-named toggle-buttons.
- * index=index
- *
- * Selects a single element based on its position in the list (offset from zero).
- *
- *
- * String-match Patterns
- *
- *
- * Various Pattern syntaxes are available for matching string values:
- *
- *
- * - glob:pattern:
- * Match a string against a "glob" (aka "wildmat") pattern. "Glob" is a
- * kind of limited regular-expression syntax typically used in command-line
- * shells. In a glob pattern, "*" represents any sequence of characters, and "?"
- * represents any single character. Glob patterns match against the entire
- * string.
- * - regexp:regexp:
- * Match a string using a regular-expression. The full power of JavaScript
- * regular-expressions is available.
- * - regexpi:regexpi:
- * Match a string using a case-insensitive regular-expression.
- * - exact:string:
- *
- * Match a string exactly, verbatim, without any of that fancy wildcard
- * stuff.
- *
- *
- * If no pattern prefix is specified, Selenium assumes that it's a "glob"
- * pattern.
- *
- *
- * For commands that return multiple values (such as verifySelectOptions),
- * the string being matched is a comma-separated list of the return values,
- * where both commas and backslashes in the values are backslash-escaped.
- * When providing a pattern, the optional matching syntax (i.e. glob,
- * regexp, etc.) is specified once, as usual, at the beginning of the
- * pattern.
- *
- */
- this.browserbot = browserbot;
- this.optionLocatorFactory = new OptionLocatorFactory();
- // DGF for backwards compatibility
- this.page = function() {
- return browserbot;
- };
- this.defaultTimeout = Selenium.DEFAULT_TIMEOUT;
- this.mouseSpeed = 10;
-}
-
-Selenium.DEFAULT_TIMEOUT = 30 * 1000;
-Selenium.DEFAULT_MOUSE_SPEED = 10;
-Selenium.RIGHT_MOUSE_CLICK = 2;
-
-Selenium.decorateFunctionWithTimeout = function(f, timeout) {
- if (f == null) {
- return null;
- }
-
- var timeoutTime = getTimeoutTime(timeout);
-
- return function() {
- if (new Date().getTime() > timeoutTime) {
- throw new SeleniumError("Timed out after " + timeout + "ms");
- }
- return f();
- };
-}
-
-Selenium.createForWindow = function(window, proxyInjectionMode) {
- if (!window.location) {
- throw "error: not a window!";
- }
- return new Selenium(BrowserBot.createForWindow(window, proxyInjectionMode));
-};
-
-Selenium.prototype.reset = function() {
- this.defaultTimeout = Selenium.DEFAULT_TIMEOUT;
- // todo: this.browserbot.reset()
- this.browserbot.selectWindow("null");
- this.browserbot.resetPopups();
-};
-
-Selenium.prototype.doClick = function(locator) {
- /**
- * Clicks on a link, button, checkbox or radio button. If the click action
- * causes a new page to load (like a link usually does), call
- * waitForPageToLoad.
- *
- * @param locator an element locator
- *
- */
- var element = this.browserbot.findElement(locator);
- var elementWithHref = getAncestorOrSelfWithJavascriptHref(element);
-
- if (browserVersion.isChrome && elementWithHref != null) {
- // SEL-621: Firefox chrome: Race condition bug in alert-handling code
- //
- // This appears to be because javascript href's are being executed in a
- // separate thread from the main thread when running in chrome mode.
- //
- // This workaround injects a callback into the executing href that
- // lowers a flag, which is initially raised. Execution of this click
- // command will wait for the flag to be lowered.
-
- var win = elementWithHref.ownerDocument.defaultView;
- var originalLocation = win.location.href;
- var originalHref = elementWithHref.href;
-
- elementWithHref.href = 'javascript:try { '
- + originalHref.replace(/^\s*javascript:/i, "")
- + '} finally { window._executingJavascriptHref = undefined; }' ;
-
- win._executingJavascriptHref = true;
-
- this.browserbot.clickElement(element);
-
- return Selenium.decorateFunctionWithTimeout(function() {
- if (win.closed) {
- return true;
- }
- if (win.location.href != originalLocation) {
- // navigated to some other page ... javascript from previous
- // page can't still be executing!
- return true;
- }
- if (! win._executingJavascriptHref) {
- try {
- elementWithHref.href = originalHref;
- }
- catch (e) {
- // maybe the javascript removed the element ... should be
- // no danger in not reverting its href attribute
- }
- return true;
- }
-
- return false;
- }, Selenium.DEFAULT_TIMEOUT);
- }
-
- this.browserbot.clickElement(element);
-};
-
-Selenium.prototype.doDoubleClick = function(locator) {
- /**
- * Double clicks on a link, button, checkbox or radio button. If the double click action
- * causes a new page to load (like a link usually does), call
- * waitForPageToLoad.
- *
- * @param locator an element locator
- *
- */
- var element = this.browserbot.findElement(locator);
- this.browserbot.doubleClickElement(element);
-};
-
-Selenium.prototype.doContextMenu = function(locator) {
- /**
- * Simulates opening the context menu for the specified element (as might happen if the user "right-clicked" on the element).
- *
- * @param locator an element locator
- *
- */
- var element = this.browserbot.findElement(locator);
- this.browserbot.contextMenuOnElement(element);
-};
-
-Selenium.prototype.doClickAt = function(locator, coordString) {
- /**
- * Clicks on a link, button, checkbox or radio button. If the click action
- * causes a new page to load (like a link usually does), call
- * waitForPageToLoad.
- *
- * @param locator an element locator
- * @param coordString specifies the x,y position (i.e. - 10,20) of the mouse
- * event relative to the element returned by the locator.
- *
- */
- var element = this.browserbot.findElement(locator);
- var clientXY = getClientXY(element, coordString)
- this.doMouseMove(locator);
- this.doMouseDown(locator);
- this.browserbot.clickElement(element, clientXY[0], clientXY[1]);
- this.doMouseUp(locator);
-};
-
-Selenium.prototype.doDoubleClickAt = function(locator, coordString) {
- /**
- * Doubleclicks on a link, button, checkbox or radio button. If the action
- * causes a new page to load (like a link usually does), call
- * waitForPageToLoad.
- *
- * @param locator an element locator
- * @param coordString specifies the x,y position (i.e. - 10,20) of the mouse
- * event relative to the element returned by the locator.
- *
- */
- var element = this.browserbot.findElement(locator);
- var clientXY = getClientXY(element, coordString)
- this.doMouseMove(locator);
- this.doMouseDown(locator);
- this.browserbot.doubleClickElement(element, clientXY[0], clientXY[1]);
- this.doMouseUp(locator);
-};
-
-Selenium.prototype.doContextMenuAt = function(locator, coordString) {
- /**
- * Simulates opening the context menu for the specified element (as might happen if the user "right-clicked" on the element).
- *
- * @param locator an element locator
- * @param coordString specifies the x,y position (i.e. - 10,20) of the mouse
- * event relative to the element returned by the locator.
- *
- */
- var element = this.browserbot.findElement(locator);
- var clientXY = getClientXY(element, coordString)
- this.browserbot.contextMenuOnElement(element, clientXY[0], clientXY[1]);
-};
-
-Selenium.prototype.doFireEvent = function(locator, eventName) {
- /**
- * Explicitly simulate an event, to trigger the corresponding "onevent"
- * handler.
- *
- * @param locator an element locator
- * @param eventName the event name, e.g. "focus" or "blur"
- */
- var element = this.browserbot.findElement(locator);
- triggerEvent(element, eventName, false);
-};
-
-Selenium.prototype.doFocus = function(locator) {
- /** Move the focus to the specified element; for example, if the element is an input field, move the cursor to that field.
- *
- * @param locator an element locator
- */
- var element = this.browserbot.findElement(locator);
- if (element.focus) {
- element.focus();
- } else {
- triggerEvent(element, "focus", false);
- }
-}
-
-Selenium.prototype.doKeyPress = function(locator, keySequence) {
- /**
- * Simulates a user pressing and releasing a key.
- *
- * @param locator an element locator
- * @param keySequence Either be a string("\" followed by the numeric keycode
- * of the key to be pressed, normally the ASCII value of that key), or a single
- * character. For example: "w", "\119".
- */
- var element = this.browserbot.findElement(locator);
- triggerKeyEvent(element, 'keypress', keySequence, true,
- this.browserbot.controlKeyDown,
- this.browserbot.altKeyDown,
- this.browserbot.shiftKeyDown,
- this.browserbot.metaKeyDown);
-};
-
-Selenium.prototype.doShiftKeyDown = function() {
- /**
- * Press the shift key and hold it down until doShiftUp() is called or a new page is loaded.
- *
- */
- this.browserbot.shiftKeyDown = true;
-};
-
-Selenium.prototype.doShiftKeyUp = function() {
- /**
- * Release the shift key.
- *
- */
- this.browserbot.shiftKeyDown = false;
-};
-
-Selenium.prototype.doMetaKeyDown = function() {
- /**
- * Press the meta key and hold it down until doMetaUp() is called or a new page is loaded.
- *
- */
- this.browserbot.metaKeyDown = true;
-};
-
-Selenium.prototype.doMetaKeyUp = function() {
- /**
- * Release the meta key.
- *
- */
- this.browserbot.metaKeyDown = false;
-};
-
-Selenium.prototype.doAltKeyDown = function() {
- /**
- * Press the alt key and hold it down until doAltUp() is called or a new page is loaded.
- *
- */
- this.browserbot.altKeyDown = true;
-};
-
-Selenium.prototype.doAltKeyUp = function() {
- /**
- * Release the alt key.
- *
- */
- this.browserbot.altKeyDown = false;
-};
-
-Selenium.prototype.doControlKeyDown = function() {
- /**
- * Press the control key and hold it down until doControlUp() is called or a new page is loaded.
- *
- */
- this.browserbot.controlKeyDown = true;
-};
-
-Selenium.prototype.doControlKeyUp = function() {
- /**
- * Release the control key.
- *
- */
- this.browserbot.controlKeyDown = false;
-};
-
-Selenium.prototype.doKeyDown = function(locator, keySequence) {
- /**
- * Simulates a user pressing a key (without releasing it yet).
- *
- * @param locator an element locator
- * @param keySequence Either be a string("\" followed by the numeric keycode
- * of the key to be pressed, normally the ASCII value of that key), or a single
- * character. For example: "w", "\119".
- */
- var element = this.browserbot.findElement(locator);
- triggerKeyEvent(element, 'keydown', keySequence, true,
- this.browserbot.controlKeyDown,
- this.browserbot.altKeyDown,
- this.browserbot.shiftKeyDown,
- this.browserbot.metaKeyDown);
-};
-
-Selenium.prototype.doKeyUp = function(locator, keySequence) {
- /**
- * Simulates a user releasing a key.
- *
- * @param locator an element locator
- * @param keySequence Either be a string("\" followed by the numeric keycode
- * of the key to be pressed, normally the ASCII value of that key), or a single
- * character. For example: "w", "\119".
- */
- var element = this.browserbot.findElement(locator);
- triggerKeyEvent(element, 'keyup', keySequence, true,
- this.browserbot.controlKeyDown,
- this.browserbot.altKeyDown,
- this.browserbot.shiftKeyDown,
- this.browserbot.metaKeyDown);
-};
-
-function getClientXY(element, coordString) {
- // Parse coordString
- var coords = null;
- var x;
- var y;
- if (coordString) {
- coords = coordString.split(/,/);
- x = Number(coords[0]);
- y = Number(coords[1]);
- }
- else {
- x = y = 0;
- }
-
- // Get position of element,
- // Return 2 item array with clientX and clientY
- return [Selenium.prototype.getElementPositionLeft(element) + x, Selenium.prototype.getElementPositionTop(element) + y];
-}
-
-Selenium.prototype.doMouseOver = function(locator) {
- /**
- * Simulates a user hovering a mouse over the specified element.
- *
- * @param locator an element locator
- */
- var element = this.browserbot.findElement(locator);
- this.browserbot.triggerMouseEvent(element, 'mouseover', true);
-};
-
-Selenium.prototype.doMouseOut = function(locator) {
- /**
- * Simulates a user moving the mouse pointer away from the specified element.
- *
- * @param locator an element locator
- */
- var element = this.browserbot.findElement(locator);
- this.browserbot.triggerMouseEvent(element, 'mouseout', true);
-};
-
-Selenium.prototype.doMouseDown = function(locator) {
- /**
- * Simulates a user pressing the left mouse button (without releasing it yet) on
- * the specified element.
- *
- * @param locator an element locator
- */
- var element = this.browserbot.findElement(locator);
- this.browserbot.triggerMouseEvent(element, 'mousedown', true);
-};
-
-Selenium.prototype.doMouseDownRight = function(locator) {
- /**
- * Simulates a user pressing the right mouse button (without releasing it yet) on
- * the specified element.
- *
- * @param locator an element locator
- */
- var element = this.browserbot.findElement(locator);
- this.browserbot.triggerMouseEvent(element, 'mousedown', true, undefined, undefined, Selenium.RIGHT_MOUSE_CLICK);
-};
-
-Selenium.prototype.doMouseDownAt = function(locator, coordString) {
- /**
- * Simulates a user pressing the left mouse button (without releasing it yet) at
- * the specified location.
- *
- * @param locator an element locator
- * @param coordString specifies the x,y position (i.e. - 10,20) of the mouse
- * event relative to the element returned by the locator.
- */
- var element = this.browserbot.findElement(locator);
- var clientXY = getClientXY(element, coordString)
-
- this.browserbot.triggerMouseEvent(element, 'mousedown', true, clientXY[0], clientXY[1]);
-};
-
-Selenium.prototype.doMouseDownRightAt = function(locator, coordString) {
- /**
- * Simulates a user pressing the right mouse button (without releasing it yet) at
- * the specified location.
- *
- * @param locator an element locator
- * @param coordString specifies the x,y position (i.e. - 10,20) of the mouse
- * event relative to the element returned by the locator.
- */
- var element = this.browserbot.findElement(locator);
- var clientXY = getClientXY(element, coordString)
-
- this.browserbot.triggerMouseEvent(element, 'mousedown', true, clientXY[0], clientXY[1], Selenium.RIGHT_MOUSE_CLICK);
-};
-
-Selenium.prototype.doMouseUp = function(locator) {
- /**
- * Simulates the event that occurs when the user releases the mouse button (i.e., stops
- * holding the button down) on the specified element.
- *
- * @param locator an element locator
- */
- var element = this.browserbot.findElement(locator);
- this.browserbot.triggerMouseEvent(element, 'mouseup', true);
-};
-
-Selenium.prototype.doMouseUpRight = function(locator) {
- /**
- * Simulates the event that occurs when the user releases the right mouse button (i.e., stops
- * holding the button down) on the specified element.
- *
- * @param locator an element locator
- */
- var element = this.browserbot.findElement(locator);
- this.browserbot.triggerMouseEvent(element, 'mouseup', true, undefined, undefined, Selenium.RIGHT_MOUSE_CLICK);
-};
-
-Selenium.prototype.doMouseUpAt = function(locator, coordString) {
- /**
- * Simulates the event that occurs when the user releases the mouse button (i.e., stops
- * holding the button down) at the specified location.
- *
- * @param locator an element locator
- * @param coordString specifies the x,y position (i.e. - 10,20) of the mouse
- * event relative to the element returned by the locator.
- */
- var element = this.browserbot.findElement(locator);
- var clientXY = getClientXY(element, coordString)
-
- this.browserbot.triggerMouseEvent(element, 'mouseup', true, clientXY[0], clientXY[1]);
-};
-
-Selenium.prototype.doMouseUpRightAt = function(locator, coordString) {
- /**
- * Simulates the event that occurs when the user releases the right mouse button (i.e., stops
- * holding the button down) at the specified location.
- *
- * @param locator an element locator
- * @param coordString specifies the x,y position (i.e. - 10,20) of the mouse
- * event relative to the element returned by the locator.
- */
- var element = this.browserbot.findElement(locator);
- var clientXY = getClientXY(element, coordString)
-
- this.browserbot.triggerMouseEvent(element, 'mouseup', true, clientXY[0], clientXY[1], Selenium.RIGHT_MOUSE_CLICK);
-};
-
-Selenium.prototype.doMouseMove = function(locator) {
- /**
- * Simulates a user pressing the mouse button (without releasing it yet) on
- * the specified element.
- *
- * @param locator an element locator
- */
- var element = this.browserbot.findElement(locator);
- this.browserbot.triggerMouseEvent(element, 'mousemove', true);
-};
-
-Selenium.prototype.doMouseMoveAt = function(locator, coordString) {
- /**
- * Simulates a user pressing the mouse button (without releasing it yet) on
- * the specified element.
- *
- * @param locator an element locator
- * @param coordString specifies the x,y position (i.e. - 10,20) of the mouse
- * event relative to the element returned by the locator.
- */
-
- var element = this.browserbot.findElement(locator);
- var clientXY = getClientXY(element, coordString)
-
- this.browserbot.triggerMouseEvent(element, 'mousemove', true, clientXY[0], clientXY[1]);
-};
-
-Selenium.prototype.doType = function(locator, value) {
- /**
- * Sets the value of an input field, as though you typed it in.
- *
- * Can also be used to set the value of combo boxes, check boxes, etc. In these cases,
- * value should be the value of the option selected, not the visible text.
- *
- * @param locator an element locator
- * @param value the value to type
- */
- if (this.browserbot.controlKeyDown || this.browserbot.altKeyDown || this.browserbot.metaKeyDown) {
- throw new SeleniumError("type not supported immediately after call to controlKeyDown() or altKeyDown() or metaKeyDown()");
- }
- // TODO fail if it can't be typed into.
- var element = this.browserbot.findElement(locator);
- if (this.browserbot.shiftKeyDown) {
- value = new String(value).toUpperCase();
- }
- this.browserbot.replaceText(element, value);
-};
-
-Selenium.prototype.doTypeKeys = function(locator, value) {
- /**
- * Simulates keystroke events on the specified element, as though you typed the value key-by-key.
- *
- * This is a convenience method for calling keyDown, keyUp, keyPress for every character in the specified string;
- * this is useful for dynamic UI widgets (like auto-completing combo boxes) that require explicit key events.
- *
- * Unlike the simple "type" command, which forces the specified value into the page directly, this command
- * may or may not have any visible effect, even in cases where typing keys would normally have a visible effect.
- * For example, if you use "typeKeys" on a form element, you may or may not see the results of what you typed in
- * the field.
- * In some cases, you may need to use the simple "type" command to set the value of the field and then the "typeKeys" command to
- * send the keystroke events corresponding to what you just typed.
- *
- * @param locator an element locator
- * @param value the value to type
- */
- var keys = new String(value).split("");
- for (var i = 0; i < keys.length; i++) {
- var c = keys[i];
- this.doKeyDown(locator, c);
- this.doKeyUp(locator, c);
- this.doKeyPress(locator, c);
- }
-};
-
-Selenium.prototype.doSetSpeed = function(value) {
- /**
- * Set execution speed (i.e., set the millisecond length of a delay which will follow each selenium operation). By default, there is no such delay, i.e.,
- * the delay is 0 milliseconds.
- *
- * @param value the number of milliseconds to pause after operation
- */
- throw new SeleniumError("this operation is only implemented in selenium-rc, and should never result in a request making it across the wire");
-};
-
-Selenium.prototype.getSpeed = function() {
- /**
- * Get execution speed (i.e., get the millisecond length of the delay following each selenium operation). By default, there is no such delay, i.e.,
- * the delay is 0 milliseconds.
- *
- * See also setSpeed.
- *
- * @return string the execution speed in milliseconds.
- */
- throw new SeleniumError("this operation is only implemented in selenium-rc, and should never result in a request making it across the wire");
-};
-
-Selenium.prototype.findToggleButton = function(locator) {
- var element = this.browserbot.findElement(locator);
- if (element.checked == null) {
- Assert.fail("Element " + locator + " is not a toggle-button.");
- }
- return element;
-}
-
-Selenium.prototype.doCheck = function(locator) {
- /**
- * Check a toggle-button (checkbox/radio)
- *
- * @param locator an element locator
- */
- this.findToggleButton(locator).checked = true;
-};
-
-Selenium.prototype.doUncheck = function(locator) {
- /**
- * Uncheck a toggle-button (checkbox/radio)
- *
- * @param locator an element locator
- */
- this.findToggleButton(locator).checked = false;
-};
-
-Selenium.prototype.doSelect = function(selectLocator, optionLocator) {
- /**
- * Select an option from a drop-down using an option locator.
- *
- *
- * Option locators provide different ways of specifying options of an HTML
- * Select element (e.g. for selecting a specific option, or for asserting
- * that the selected option satisfies a specification). There are several
- * forms of Select Option Locator.
- *
- *
- * - label=labelPattern:
- * matches options based on their labels, i.e. the visible text. (This
- * is the default.)
- *
- * - label=regexp:^[Oo]ther
- *
- *
- * - value=valuePattern:
- * matches options based on their values.
- *
- *
- *
- *
- * - id=id:
- *
- * matches options based on their ids.
- *
- *
- * - index=index:
- * matches an option based on its index (offset from zero).
- *
- *
- *
- *
- * If no option locator prefix is provided, the default behaviour is to match on label.
- *
- *
- *
- * @param selectLocator an element locator identifying a drop-down menu
- * @param optionLocator an option locator (a label by default)
- */
- var element = this.browserbot.findElement(selectLocator);
- if (!("options" in element)) {
- throw new SeleniumError("Specified element is not a Select (has no options)");
- }
- var locator = this.optionLocatorFactory.fromLocatorString(optionLocator);
- var option = locator.findOption(element);
- this.browserbot.selectOption(element, option);
-};
-
-
-
-Selenium.prototype.doAddSelection = function(locator, optionLocator) {
- /**
- * Add a selection to the set of selected options in a multi-select element using an option locator.
- *
- * @see #doSelect for details of option locators
- *
- * @param locator an element locator identifying a multi-select box
- * @param optionLocator an option locator (a label by default)
- */
- var element = this.browserbot.findElement(locator);
- if (!("options" in element)) {
- throw new SeleniumError("Specified element is not a Select (has no options)");
- }
- var locator = this.optionLocatorFactory.fromLocatorString(optionLocator);
- var option = locator.findOption(element);
- this.browserbot.addSelection(element, option);
-};
-
-Selenium.prototype.doRemoveSelection = function(locator, optionLocator) {
- /**
- * Remove a selection from the set of selected options in a multi-select element using an option locator.
- *
- * @see #doSelect for details of option locators
- *
- * @param locator an element locator identifying a multi-select box
- * @param optionLocator an option locator (a label by default)
- */
-
- var element = this.browserbot.findElement(locator);
- if (!("options" in element)) {
- throw new SeleniumError("Specified element is not a Select (has no options)");
- }
- var locator = this.optionLocatorFactory.fromLocatorString(optionLocator);
- var option = locator.findOption(element);
- this.browserbot.removeSelection(element, option);
-};
-
-Selenium.prototype.doRemoveAllSelections = function(locator) {
- /**
- * Unselects all of the selected options in a multi-select element.
- *
- * @param locator an element locator identifying a multi-select box
- */
- var element = this.browserbot.findElement(locator);
- if (!("options" in element)) {
- throw new SeleniumError("Specified element is not a Select (has no options)");
- }
- for (var i = 0; i < element.options.length; i++) {
- this.browserbot.removeSelection(element, element.options[i]);
- }
-}
-
-Selenium.prototype.doSubmit = function(formLocator) {
- /**
- * Submit the specified form. This is particularly useful for forms without
- * submit buttons, e.g. single-input "Search" forms.
- *
- * @param formLocator an element locator for the form you want to submit
- */
- var form = this.browserbot.findElement(formLocator);
- return this.browserbot.submit(form);
-
-};
-
-Selenium.prototype.makePageLoadCondition = function(timeout) {
- if (timeout == null) {
- timeout = this.defaultTimeout;
- }
- // if the timeout is zero, we won't wait for the page to load before returning
- if (timeout == 0) {
- return;
- }
- return Selenium.decorateFunctionWithTimeout(fnBind(this._isNewPageLoaded, this), timeout);
-};
-
-Selenium.prototype.doOpen = function(url) {
- /**
- * Opens an URL in the test frame. This accepts both relative and absolute
- * URLs.
- *
- * The "open" command waits for the page to load before proceeding,
- * ie. the "AndWait" suffix is implicit.
- *
- * Note: The URL must be on the same domain as the runner HTML
- * due to security restrictions in the browser (Same Origin Policy). If you
- * need to open an URL on another domain, use the Selenium Server to start a
- * new browser session on that domain.
- *
- * @param url the URL to open; may be relative or absolute
- */
- this.browserbot.openLocation(url);
- if (window["proxyInjectionMode"] == null || !window["proxyInjectionMode"]) {
- return this.makePageLoadCondition();
- } // in PI mode, just return "OK"; the server will waitForLoad
-};
-
-Selenium.prototype.doOpenWindow = function(url, windowID) {
- /**
- * Opens a popup window (if a window with that ID isn't already open).
- * After opening the window, you'll need to select it using the selectWindow
- * command.
- *
- * This command can also be a useful workaround for bug SEL-339. In some cases, Selenium will be unable to intercept a call to window.open (if the call occurs during or before the "onLoad" event, for example).
- * In those cases, you can force Selenium to notice the open window's name by using the Selenium openWindow command, using
- * an empty (blank) url, like this: openWindow("", "myFunnyWindow").
- *
- * @param url the URL to open, which can be blank
- * @param windowID the JavaScript window ID of the window to select
- */
- this.browserbot.openWindow(url, windowID);
-};
-
-Selenium.prototype.doSelectWindow = function(windowID) {
- /**
- * Selects a popup window using a window locator; once a popup window has been selected, all
- * commands go to that window. To select the main window again, use null
- * as the target.
- *
- *
- *
- * Window locators provide different ways of specifying the window object:
- * by title, by internal JavaScript "name," or by JavaScript variable.
- *
- *
- * - title=My Special Window:
- * Finds the window using the text that appears in the title bar. Be careful;
- * two windows can share the same title. If that happens, this locator will
- * just pick one.
- *
- * - name=myWindow:
- * Finds the window using its internal JavaScript "name" property. This is the second
- * parameter "windowName" passed to the JavaScript method window.open(url, windowName, windowFeatures, replaceFlag)
- * (which Selenium intercepts).
- *
- * - var=variableName:
- * Some pop-up windows are unnamed (anonymous), but are associated with a JavaScript variable name in the current
- * application window, e.g. "window.foo = window.open(url);". In those cases, you can open the window using
- * "var=foo".
- *
- *
- *
- * If no window locator prefix is provided, we'll try to guess what you mean like this:
- * 1.) if windowID is null, (or the string "null") then it is assumed the user is referring to the original window instantiated by the browser).
- * 2.) if the value of the "windowID" parameter is a JavaScript variable name in the current application window, then it is assumed
- * that this variable contains the return value from a call to the JavaScript window.open() method.
- * 3.) Otherwise, selenium looks in a hash it maintains that maps string names to window "names".
- * 4.) If that fails, we'll try looping over all of the known windows to try to find the appropriate "title".
- * Since "title" is not necessarily unique, this may have unexpected behavior.
- *
- * If you're having trouble figuring out the name of a window that you want to manipulate, look at the Selenium log messages
- * which identify the names of windows created via window.open (and therefore intercepted by Selenium). You will see messages
- * like the following for each window as it is opened:
- *
- * debug: window.open call intercepted; window ID (which you can use with selectWindow()) is "myNewWindow"
- *
- * In some cases, Selenium will be unable to intercept a call to window.open (if the call occurs during or before the "onLoad" event, for example).
- * (This is bug SEL-339.) In those cases, you can force Selenium to notice the open window's name by using the Selenium openWindow command, using
- * an empty (blank) url, like this: openWindow("", "myFunnyWindow").
- *
- * @param windowID the JavaScript window ID of the window to select
- */
- this.browserbot.selectWindow(windowID);
-};
-
-Selenium.prototype.doSelectFrame = function(locator) {
- /**
- * Selects a frame within the current window. (You may invoke this command
- * multiple times to select nested frames.) To select the parent frame, use
- * "relative=parent" as a locator; to select the top frame, use "relative=top".
- * You can also select a frame by its 0-based index number; select the first frame with
- * "index=0", or the third frame with "index=2".
- *
- * You may also use a DOM expression to identify the frame you want directly,
- * like this: dom=frames["main"].frames["subframe"]
- *
- * @param locator an element locator identifying a frame or iframe
- */
- this.browserbot.selectFrame(locator);
-};
-
-Selenium.prototype.getWhetherThisFrameMatchFrameExpression = function(currentFrameString, target) {
- /**
- * Determine whether current/locator identify the frame containing this running code.
- *
- * This is useful in proxy injection mode, where this code runs in every
- * browser frame and window, and sometimes the selenium server needs to identify
- * the "current" frame. In this case, when the test calls selectFrame, this
- * routine is called for each frame to figure out which one has been selected.
- * The selected frame will return true, while all others will return false.
- *
- * @param currentFrameString starting frame
- * @param target new frame (which might be relative to the current one)
- * @return boolean true if the new frame is this code's window
- */
- return this.browserbot.doesThisFrameMatchFrameExpression(currentFrameString, target);
-};
-
-Selenium.prototype.getWhetherThisWindowMatchWindowExpression = function(currentWindowString, target) {
- /**
- * Determine whether currentWindowString plus target identify the window containing this running code.
- *
- * This is useful in proxy injection mode, where this code runs in every
- * browser frame and window, and sometimes the selenium server needs to identify
- * the "current" window. In this case, when the test calls selectWindow, this
- * routine is called for each window to figure out which one has been selected.
- * The selected window will return true, while all others will return false.
- *
- * @param currentWindowString starting window
- * @param target new window (which might be relative to the current one, e.g., "_parent")
- * @return boolean true if the new window is this code's window
- */
- if (window.opener!=null && window.opener[target]!=null && window.opener[target]==window) {
- return true;
- }
- return false;
-};
-
-Selenium.prototype.doWaitForPopUp = function(windowID, timeout) {
- /**
- * Waits for a popup window to appear and load up.
- *
- * @param windowID the JavaScript window "name" of the window that will appear (not the text of the title bar)
- * @param timeout a timeout in milliseconds, after which the action will return with an error
- */
- var timeoutTime = getTimeoutTime(timeout);
-
- var popupLoadedPredicate = function () {
- var targetWindow;
- try {
- targetWindow = selenium.browserbot.getWindowByName(windowID, true);
- }
- catch (e) {
- if (new Date().getTime() > timeoutTime) {
- throw e;
- }
- }
-
- if (!targetWindow) return false;
- if (!targetWindow.location) return false;
- if ("about:blank" == targetWindow.location) return false;
- if (browserVersion.isKonqueror) {
- if ("/" == targetWindow.location.href) {
- // apparently Konqueror uses this as the temporary location, instead of about:blank
- return false;
- }
- }
- if (browserVersion.isSafari) {
- if(targetWindow.location.href == selenium.browserbot.buttonWindow.location.href) {
- // Apparently Safari uses this as the temporary location, instead of about:blank
- // what a world!
- LOG.debug("DGF what a world!");
- return false;
- }
- }
- if (!targetWindow.document) return false;
- if (!selenium.browserbot.getCurrentWindow().document.readyState) {
- // This is Firefox, with no readyState extension
- return true;
- }
- if ('complete' != targetWindow.document.readyState) return false;
- return true;
- };
-
- return Selenium.decorateFunctionWithTimeout(popupLoadedPredicate, timeout);
-}
-
-Selenium.prototype.doWaitForPopUp.dontCheckAlertsAndConfirms = true;
-
-Selenium.prototype.doChooseCancelOnNextConfirmation = function() {
- /**
- *
- * By default, Selenium's overridden window.confirm() function will
- * return true, as if the user had manually clicked OK; after running
- * this command, the next call to confirm() will return false, as if
- * the user had clicked Cancel. Selenium will then resume using the
- * default behavior for future confirmations, automatically returning
- * true (OK) unless/until you explicitly call this command for each
- * confirmation.
- *
- *
- * Take note - every time a confirmation comes up, you must
- * consume it with a corresponding getConfirmation, or else
- * the next selenium operation will fail.
- *
- */
- this.browserbot.cancelNextConfirmation(false);
-};
-
-Selenium.prototype.doChooseOkOnNextConfirmation = function() {
- /**
- *
- * Undo the effect of calling chooseCancelOnNextConfirmation. Note
- * that Selenium's overridden window.confirm() function will normally automatically
- * return true, as if the user had manually clicked OK, so you shouldn't
- * need to use this command unless for some reason you need to change
- * your mind prior to the next confirmation. After any confirmation, Selenium will resume using the
- * default behavior for future confirmations, automatically returning
- * true (OK) unless/until you explicitly call chooseCancelOnNextConfirmation for each
- * confirmation.
- *
- *
- * Take note - every time a confirmation comes up, you must
- * consume it with a corresponding getConfirmation, or else
- * the next selenium operation will fail.
- *
- *
- */
- this.browserbot.cancelNextConfirmation(true);
-};
-
-Selenium.prototype.doAnswerOnNextPrompt = function(answer) {
- /**
- * Instructs Selenium to return the specified answer string in response to
- * the next JavaScript prompt [window.prompt()].
- *
- *
- * @param answer the answer to give in response to the prompt pop-up
- */
- this.browserbot.setNextPromptResult(answer);
-};
-
-Selenium.prototype.doGoBack = function() {
- /**
- * Simulates the user clicking the "back" button on their browser.
- *
- */
- this.browserbot.goBack();
-};
-
-Selenium.prototype.doRefresh = function() {
- /**
- * Simulates the user clicking the "Refresh" button on their browser.
- *
- */
- this.browserbot.refresh();
-};
-
-Selenium.prototype.doClose = function() {
- /**
- * Simulates the user clicking the "close" button in the titlebar of a popup
- * window or tab.
- */
- this.browserbot.close();
-};
-
-Selenium.prototype.ensureNoUnhandledPopups = function() {
- if (this.browserbot.hasAlerts()) {
- throw new SeleniumError("There was an unexpected Alert! [" + this.browserbot.getNextAlert() + "]");
- }
- if ( this.browserbot.hasConfirmations() ) {
- throw new SeleniumError("There was an unexpected Confirmation! [" + this.browserbot.getNextConfirmation() + "]");
- }
-};
-
-Selenium.prototype.isAlertPresent = function() {
- /**
- * Has an alert occurred?
- *
- *
- * This function never throws an exception
- *
- * @return boolean true if there is an alert
- */
- return this.browserbot.hasAlerts();
-};
-
-Selenium.prototype.isPromptPresent = function() {
- /**
- * Has a prompt occurred?
- *
- *
- * This function never throws an exception
- *
- * @return boolean true if there is a pending prompt
- */
- return this.browserbot.hasPrompts();
-};
-
-Selenium.prototype.isConfirmationPresent = function() {
- /**
- * Has confirm() been called?
- *
- *
- * This function never throws an exception
- *
- * @return boolean true if there is a pending confirmation
- */
- return this.browserbot.hasConfirmations();
-};
-Selenium.prototype.getAlert = function() {
- /**
- * Retrieves the message of a JavaScript alert generated during the previous action, or fail if there were no alerts.
- *
- * Getting an alert has the same effect as manually clicking OK. If an
- * alert is generated but you do not consume it with getAlert, the next Selenium action
- * will fail.
- *
- * Under Selenium, JavaScript alerts will NOT pop up a visible alert
- * dialog.
- *
- * Selenium does NOT support JavaScript alerts that are generated in a
- * page's onload() event handler. In this case a visible dialog WILL be
- * generated and Selenium will hang until someone manually clicks OK.
- * @return string The message of the most recent JavaScript alert
-
- */
- if (!this.browserbot.hasAlerts()) {
- Assert.fail("There were no alerts");
- }
- return this.browserbot.getNextAlert();
-};
-Selenium.prototype.getAlert.dontCheckAlertsAndConfirms = true;
-
-Selenium.prototype.getConfirmation = function() {
- /**
- * Retrieves the message of a JavaScript confirmation dialog generated during
- * the previous action.
- *
- *
- * By default, the confirm function will return true, having the same effect
- * as manually clicking OK. This can be changed by prior execution of the
- * chooseCancelOnNextConfirmation command.
- *
- *
- * If an confirmation is generated but you do not consume it with getConfirmation,
- * the next Selenium action will fail.
- *
- *
- *
- * NOTE: under Selenium, JavaScript confirmations will NOT pop up a visible
- * dialog.
- *
- *
- *
- * NOTE: Selenium does NOT support JavaScript confirmations that are
- * generated in a page's onload() event handler. In this case a visible
- * dialog WILL be generated and Selenium will hang until you manually click
- * OK.
- *
- *
- * @return string the message of the most recent JavaScript confirmation dialog
- */
- if (!this.browserbot.hasConfirmations()) {
- Assert.fail("There were no confirmations");
- }
- return this.browserbot.getNextConfirmation();
-};
-Selenium.prototype.getConfirmation.dontCheckAlertsAndConfirms = true;
-
-Selenium.prototype.getPrompt = function() {
- /**
- * Retrieves the message of a JavaScript question prompt dialog generated during
- * the previous action.
- *
- * Successful handling of the prompt requires prior execution of the
- * answerOnNextPrompt command. If a prompt is generated but you
- * do not get/verify it, the next Selenium action will fail.
- *
- * NOTE: under Selenium, JavaScript prompts will NOT pop up a visible
- * dialog.
- *
- * NOTE: Selenium does NOT support JavaScript prompts that are generated in a
- * page's onload() event handler. In this case a visible dialog WILL be
- * generated and Selenium will hang until someone manually clicks OK.
- * @return string the message of the most recent JavaScript question prompt
- */
- if (! this.browserbot.hasPrompts()) {
- Assert.fail("There were no prompts");
- }
- return this.browserbot.getNextPrompt();
-};
-
-Selenium.prototype.getLocation = function() {
- /** Gets the absolute URL of the current page.
- *
- * @return string the absolute URL of the current page
- */
- return this.browserbot.getCurrentWindow().location.href;
-};
-
-Selenium.prototype.getTitle = function() {
- /** Gets the title of the current page.
- *
- * @return string the title of the current page
- */
- return this.browserbot.getTitle();
-};
-
-
-Selenium.prototype.getBodyText = function() {
- /**
- * Gets the entire text of the page.
- * @return string the entire text of the page
- */
- return this.browserbot.bodyText();
-};
-
-
-Selenium.prototype.getValue = function(locator) {
- /**
- * Gets the (whitespace-trimmed) value of an input field (or anything else with a value parameter).
- * For checkbox/radio elements, the value will be "on" or "off" depending on
- * whether the element is checked or not.
- *
- * @param locator an element locator
- * @return string the element value, or "on/off" for checkbox/radio elements
- */
- var element = this.browserbot.findElement(locator)
- return getInputValue(element).trim();
-}
-
-Selenium.prototype.getText = function(locator) {
- /**
- * Gets the text of an element. This works for any element that contains
- * text. This command uses either the textContent (Mozilla-like browsers) or
- * the innerText (IE-like browsers) of the element, which is the rendered
- * text shown to the user.
- *
- * @param locator an element locator
- * @return string the text of the element
- */
- var element = this.browserbot.findElement(locator);
- return getText(element).trim();
-};
-
-Selenium.prototype.doHighlight = function(locator) {
- /**
- * Briefly changes the backgroundColor of the specified element yellow. Useful for debugging.
- *
- * @param locator an element locator
- */
- var element = this.browserbot.findElement(locator);
- this.browserbot.highlight(element, true);
-};
-
-Selenium.prototype.getEval = function(script) {
- /** Gets the result of evaluating the specified JavaScript snippet. The snippet may
- * have multiple lines, but only the result of the last line will be returned.
- *
- * Note that, by default, the snippet will run in the context of the "selenium"
- * object itself, so this will refer to the Selenium object. Use window to
- * refer to the window of your application, e.g. window.document.getElementById('foo')
- *
- * If you need to use
- * a locator to refer to a single element in your application page, you can
- * use this.browserbot.findElement("id=foo") where "id=foo" is your locator.
- *
- * @param script the JavaScript snippet to run
- * @return string the results of evaluating the snippet
- */
- try {
- var window = this.browserbot.getCurrentWindow();
- var result = eval(script);
- // Selenium RC doesn't allow returning null
- if (null == result) return "null";
- return result;
- } catch (e) {
- throw new SeleniumError("Threw an exception: " + extractExceptionMessage(e));
- }
-};
-
-Selenium.prototype.isChecked = function(locator) {
- /**
- * Gets whether a toggle-button (checkbox/radio) is checked. Fails if the specified element doesn't exist or isn't a toggle-button.
- * @param locator an element locator pointing to a checkbox or radio button
- * @return boolean true if the checkbox is checked, false otherwise
- */
- var element = this.browserbot.findElement(locator);
- if (element.checked == null) {
- throw new SeleniumError("Element " + locator + " is not a toggle-button.");
- }
- return element.checked;
-};
-
-Selenium.prototype.getTable = function(tableCellAddress) {
- /**
- * Gets the text from a cell of a table. The cellAddress syntax
- * tableLocator.row.column, where row and column start at 0.
- *
- * @param tableCellAddress a cell address, e.g. "foo.1.4"
- * @return string the text from the specified cell
- */
- // This regular expression matches "tableName.row.column"
- // For example, "mytable.3.4"
- pattern = /(.*)\.(\d+)\.(\d+)/;
-
- if(!pattern.test(tableCellAddress)) {
- throw new SeleniumError("Invalid target format. Correct format is tableName.rowNum.columnNum");
- }
-
- pieces = tableCellAddress.match(pattern);
-
- tableName = pieces[1];
- row = pieces[2];
- col = pieces[3];
-
- var table = this.browserbot.findElement(tableName);
- if (row > table.rows.length) {
- Assert.fail("Cannot access row " + row + " - table has " + table.rows.length + " rows");
- }
- else if (col > table.rows[row].cells.length) {
- Assert.fail("Cannot access column " + col + " - table row has " + table.rows[row].cells.length + " columns");
- }
- else {
- actualContent = getText(table.rows[row].cells[col]);
- return actualContent.trim();
- }
- return null;
-};
-
-Selenium.prototype.getSelectedLabels = function(selectLocator) {
- /** Gets all option labels (visible text) for selected options in the specified select or multi-select element.
- *
- * @param selectLocator an element locator identifying a drop-down menu
- * @return string[] an array of all selected option labels in the specified select drop-down
- */
- return this.findSelectedOptionProperties(selectLocator, "text");
-}
-
-Selenium.prototype.getSelectedLabel = function(selectLocator) {
- /** Gets option label (visible text) for selected option in the specified select element.
- *
- * @param selectLocator an element locator identifying a drop-down menu
- * @return string the selected option label in the specified select drop-down
- */
- return this.findSelectedOptionProperty(selectLocator, "text");
-}
-
-Selenium.prototype.getSelectedValues = function(selectLocator) {
- /** Gets all option values (value attributes) for selected options in the specified select or multi-select element.
- *
- * @param selectLocator an element locator identifying a drop-down menu
- * @return string[] an array of all selected option values in the specified select drop-down
- */
- return this.findSelectedOptionProperties(selectLocator, "value");
-}
-
-Selenium.prototype.getSelectedValue = function(selectLocator) {
- /** Gets option value (value attribute) for selected option in the specified select element.
- *
- * @param selectLocator an element locator identifying a drop-down menu
- * @return string the selected option value in the specified select drop-down
- */
- return this.findSelectedOptionProperty(selectLocator, "value");
-}
-
-Selenium.prototype.getSelectedIndexes = function(selectLocator) {
- /** Gets all option indexes (option number, starting at 0) for selected options in the specified select or multi-select element.
- *
- * @param selectLocator an element locator identifying a drop-down menu
- * @return string[] an array of all selected option indexes in the specified select drop-down
- */
- return this.findSelectedOptionProperties(selectLocator, "index");
-}
-
-Selenium.prototype.getSelectedIndex = function(selectLocator) {
- /** Gets option index (option number, starting at 0) for selected option in the specified select element.
- *
- * @param selectLocator an element locator identifying a drop-down menu
- * @return string the selected option index in the specified select drop-down
- */
- return this.findSelectedOptionProperty(selectLocator, "index");
-}
-
-Selenium.prototype.getSelectedIds = function(selectLocator) {
- /** Gets all option element IDs for selected options in the specified select or multi-select element.
- *
- * @param selectLocator an element locator identifying a drop-down menu
- * @return string[] an array of all selected option IDs in the specified select drop-down
- */
- return this.findSelectedOptionProperties(selectLocator, "id");
-}
-
-Selenium.prototype.getSelectedId = function(selectLocator) {
- /** Gets option element ID for selected option in the specified select element.
- *
- * @param selectLocator an element locator identifying a drop-down menu
- * @return string the selected option ID in the specified select drop-down
- */
- return this.findSelectedOptionProperty(selectLocator, "id");
-}
-
-Selenium.prototype.isSomethingSelected = function(selectLocator) {
- /** Determines whether some option in a drop-down menu is selected.
- *
- * @param selectLocator an element locator identifying a drop-down menu
- * @return boolean true if some option has been selected, false otherwise
- */
- var element = this.browserbot.findElement(selectLocator);
- if (!("options" in element)) {
- throw new SeleniumError("Specified element is not a Select (has no options)");
- }
-
- var selectedOptions = [];
-
- for (var i = 0; i < element.options.length; i++) {
- if (element.options[i].selected)
- {
- return true;
- }
- }
- return false;
-}
-
-Selenium.prototype.findSelectedOptionProperties = function(locator, property) {
- var element = this.browserbot.findElement(locator);
- if (!("options" in element)) {
- throw new SeleniumError("Specified element is not a Select (has no options)");
- }
-
- var selectedOptions = [];
-
- for (var i = 0; i < element.options.length; i++) {
- if (element.options[i].selected)
- {
- var propVal = element.options[i][property];
- selectedOptions.push(propVal);
- }
- }
- if (selectedOptions.length == 0) Assert.fail("No option selected");
- return selectedOptions;
-}
-
-Selenium.prototype.findSelectedOptionProperty = function(locator, property) {
- var selectedOptions = this.findSelectedOptionProperties(locator, property);
- if (selectedOptions.length > 1) {
- Assert.fail("More than one selected option!");
- }
- return selectedOptions[0];
-}
-
-Selenium.prototype.getSelectOptions = function(selectLocator) {
- /** Gets all option labels in the specified select drop-down.
- *
- * @param selectLocator an element locator identifying a drop-down menu
- * @return string[] an array of all option labels in the specified select drop-down
- */
- var element = this.browserbot.findElement(selectLocator);
-
- var selectOptions = [];
-
- for (var i = 0; i < element.options.length; i++) {
- var option = element.options[i].text;
- selectOptions.push(option);
- }
-
- return selectOptions;
-};
-
-
-Selenium.prototype.getAttribute = function(attributeLocator) {
- /**
- * Gets the value of an element attribute. The value of the attribute may
- * differ across browsers (this is the case for the "style" attribute, for
- * example).
- *
- * @param attributeLocator an element locator followed by an @ sign and then the name of the attribute, e.g. "foo@bar"
- * @return string the value of the specified attribute
- */
- var result = this.browserbot.findAttribute(attributeLocator);
- if (result == null) {
- throw new SeleniumError("Could not find element attribute: " + attributeLocator);
- }
- return result;
-};
-
-Selenium.prototype.isTextPresent = function(pattern) {
- /**
- * Verifies that the specified text pattern appears somewhere on the rendered page shown to the user.
- * @param pattern a pattern to match with the text of the page
- * @return boolean true if the pattern matches the text, false otherwise
- */
- var allText = this.browserbot.bodyText();
-
- var patternMatcher = new PatternMatcher(pattern);
- if (patternMatcher.strategy == PatternMatcher.strategies.glob) {
- if (pattern.indexOf("glob:")==0) {
- pattern = pattern.substring("glob:".length); // strip off "glob:"
- }
- patternMatcher.matcher = new PatternMatcher.strategies.globContains(pattern);
- }
- else if (patternMatcher.strategy == PatternMatcher.strategies.exact) {
- pattern = pattern.substring("exact:".length); // strip off "exact:"
- return allText.indexOf(pattern) != -1;
- }
- return patternMatcher.matches(allText);
-};
-
-Selenium.prototype.isElementPresent = function(locator) {
- /**
- * Verifies that the specified element is somewhere on the page.
- * @param locator an element locator
- * @return boolean true if the element is present, false otherwise
- */
- var element = this.browserbot.findElementOrNull(locator);
- if (element == null) {
- return false;
- }
- return true;
-};
-
-Selenium.prototype.isVisible = function(locator) {
- /**
- * Determines if the specified element is visible. An
- * element can be rendered invisible by setting the CSS "visibility"
- * property to "hidden", or the "display" property to "none", either for the
- * element itself or one if its ancestors. This method will fail if
- * the element is not present.
- *
- * @param locator an element locator
- * @return boolean true if the specified element is visible, false otherwise
- */
- var element;
- element = this.browserbot.findElement(locator);
- // DGF if it's an input tag of type "hidden" then it's not visible
- if (element.tagName) {
- var tagName = new String(element.tagName).toLowerCase();
- if (tagName == "input") {
- if (element.type) {
- var elementType = new String(element.type).toLowerCase();
- if (elementType == "hidden") {
- return false;
- }
- }
- }
- }
- var visibility = this.findEffectiveStyleProperty(element, "visibility");
- var _isDisplayed = this._isDisplayed(element);
- return (visibility != "hidden" && _isDisplayed);
-};
-
-Selenium.prototype.findEffectiveStyleProperty = function(element, property) {
- var effectiveStyle = this.findEffectiveStyle(element);
- var propertyValue = effectiveStyle[property];
- if (propertyValue == 'inherit' && element.parentNode.style) {
- return this.findEffectiveStyleProperty(element.parentNode, property);
- }
- return propertyValue;
-};
-
-Selenium.prototype._isDisplayed = function(element) {
- var display = this.findEffectiveStyleProperty(element, "display");
- if (display == "none") return false;
- if (element.parentNode.style) {
- return this._isDisplayed(element.parentNode);
- }
- return true;
-};
-
-Selenium.prototype.findEffectiveStyle = function(element) {
- if (element.style == undefined) {
- return undefined; // not a styled element
- }
- var window = this.browserbot.getCurrentWindow();
- if (window.getComputedStyle) {
- // DOM-Level-2-CSS
- return window.getComputedStyle(element, null);
- }
- if (element.currentStyle) {
- // non-standard IE alternative
- return element.currentStyle;
- // TODO: this won't really work in a general sense, as
- // currentStyle is not identical to getComputedStyle()
- // ... but it's good enough for "visibility"
- }
-
- if (window.document.defaultView && window.document.defaultView.getComputedStyle) {
- return window.document.defaultView.getComputedStyle(element, null);
- }
-
-
- throw new SeleniumError("cannot determine effective stylesheet in this browser");
-};
-
-Selenium.prototype.isEditable = function(locator) {
- /**
- * Determines whether the specified input element is editable, ie hasn't been disabled.
- * This method will fail if the specified element isn't an input element.
- *
- * @param locator an element locator
- * @return boolean true if the input element is editable, false otherwise
- */
- var element = this.browserbot.findElement(locator);
- if (element.value == undefined) {
- Assert.fail("Element " + locator + " is not an input.");
- }
- if (element.disabled) {
- return false;
- }
- // DGF "readonly" is a bit goofy... it doesn't necessarily have a value
- // You can write
- var readOnlyNode = element.getAttributeNode('readonly');
- if (readOnlyNode) {
- // DGF on IE, every input element has a readOnly node, but it may be false
- if (typeof(readOnlyNode.nodeValue) == "boolean") {
- var readOnly = readOnlyNode.nodeValue;
- if (readOnly) {
- return false;
- }
- } else {
- return false;
- }
- }
- return true;
-};
-
-Selenium.prototype.getAllButtons = function() {
- /** Returns the IDs of all buttons on the page.
- *
- * If a given button has no ID, it will appear as "" in this array.
- *
- * @return string[] the IDs of all buttons on the page
- */
- return this.browserbot.getAllButtons();
-};
-
-Selenium.prototype.getAllLinks = function() {
- /** Returns the IDs of all links on the page.
- *
- * If a given link has no ID, it will appear as "" in this array.
- *
- * @return string[] the IDs of all links on the page
- */
- return this.browserbot.getAllLinks();
-};
-
-Selenium.prototype.getAllFields = function() {
- /** Returns the IDs of all input fields on the page.
- *
- * If a given field has no ID, it will appear as "" in this array.
- *
- * @return string[] the IDs of all field on the page
- */
- return this.browserbot.getAllFields();
-};
-
-Selenium.prototype.getAttributeFromAllWindows = function(attributeName) {
- /** Returns every instance of some attribute from all known windows.
- *
- * @param attributeName name of an attribute on the windows
- * @return string[] the set of values of this attribute from all known windows.
- */
- var attributes = new Array();
-
- var win = selenium.browserbot.topWindow;
-
- // DGF normally you should use []s instead of eval "win."+attributeName
- // but in this case, attributeName may contain dots (e.g. document.title)
- // in that case, we have no choice but to use eval...
- attributes.push(eval("win."+attributeName));
- for (var windowName in this.browserbot.openedWindows)
- {
- try {
- win = selenium.browserbot.openedWindows[windowName];
- attributes.push(eval("win."+attributeName));
- } catch (e) {} // DGF If we miss one... meh. It's probably closed or inaccessible anyway.
- }
- return attributes;
-};
-
-Selenium.prototype.findWindow = function(soughtAfterWindowPropertyValue) {
- var targetPropertyName = "name";
- if (soughtAfterWindowPropertyValue.match("^title=")) {
- targetPropertyName = "document.title";
- soughtAfterWindowPropertyValue = soughtAfterWindowPropertyValue.replace(/^title=/, "");
- }
- else {
- // matching "name":
- // If we are not in proxy injection mode, then the top-level test window will be named selenium_myiframe.
- // But as far as the interface goes, we are expected to match a blank string to this window, if
- // we are searching with respect to the widow name.
- // So make a special case so that this logic will work:
- if (PatternMatcher.matches(soughtAfterWindowPropertyValue, "")) {
- return this.browserbot.getCurrentWindow();
- }
- }
-
- // DGF normally you should use []s instead of eval "win."+attributeName
- // but in this case, attributeName may contain dots (e.g. document.title)
- // in that case, we have no choice but to use eval...
- if (PatternMatcher.matches(soughtAfterWindowPropertyValue, eval("this.browserbot.topWindow." + targetPropertyName))) {
- return this.browserbot.topWindow;
- }
- for (windowName in selenium.browserbot.openedWindows) {
- var openedWindow = selenium.browserbot.openedWindows[windowName];
- if (PatternMatcher.matches(soughtAfterWindowPropertyValue, eval("openedWindow." + targetPropertyName))) {
- return openedWindow;
- }
- }
- throw new SeleniumError("could not find window with property " + targetPropertyName + " matching " + soughtAfterWindowPropertyValue);
-};
-
-Selenium.prototype.doDragdrop = function(locator, movementsString) {
-/** deprecated - use dragAndDrop instead
- *
- * @param locator an element locator
- * @param movementsString offset in pixels from the current location to which the element should be moved, e.g., "+70,-300"
- */
- this.doDragAndDrop(locator, movementsString);
-};
-
-Selenium.prototype.doSetMouseSpeed = function(pixels) {
- /** Configure the number of pixels between "mousemove" events during dragAndDrop commands (default=10).
- * Setting this value to 0 means that we'll send a "mousemove" event to every single pixel
- * in between the start location and the end location; that can be very slow, and may
- * cause some browsers to force the JavaScript to timeout.
- *
- * If the mouse speed is greater than the distance between the two dragged objects, we'll
- * just send one "mousemove" at the start location and then one final one at the end location.
- * @param pixels the number of pixels between "mousemove" events
- */
- this.mouseSpeed = pixels;
-}
-
-Selenium.prototype.getMouseSpeed = function() {
- /** Returns the number of pixels between "mousemove" events during dragAndDrop commands (default=10).
- *
- * @return number the number of pixels between "mousemove" events during dragAndDrop commands (default=10)
- */
- this.mouseSpeed = pixels;
-}
-
-
-Selenium.prototype.doDragAndDrop = function(locator, movementsString) {
- /** Drags an element a certain distance and then drops it
- * @param locator an element locator
- * @param movementsString offset in pixels from the current location to which the element should be moved, e.g., "+70,-300"
- */
- var element = this.browserbot.findElement(locator);
- var clientStartXY = getClientXY(element)
- var clientStartX = clientStartXY[0];
- var clientStartY = clientStartXY[1];
-
- var movements = movementsString.split(/,/);
- var movementX = Number(movements[0]);
- var movementY = Number(movements[1]);
-
- var clientFinishX = ((clientStartX + movementX) < 0) ? 0 : (clientStartX + movementX);
- var clientFinishY = ((clientStartY + movementY) < 0) ? 0 : (clientStartY + movementY);
-
- var mouseSpeed = this.mouseSpeed;
- var move = function(current, dest) {
- if (current == dest) return current;
- if (Math.abs(current - dest) < mouseSpeed) return dest;
- return (current < dest) ? current + mouseSpeed : current - mouseSpeed;
- }
-
- this.browserbot.triggerMouseEvent(element, 'mousedown', true, clientStartX, clientStartY);
- this.browserbot.triggerMouseEvent(element, 'mousemove', true, clientStartX, clientStartY);
- var clientX = clientStartX;
- var clientY = clientStartY;
-
- while ((clientX != clientFinishX) || (clientY != clientFinishY)) {
- clientX = move(clientX, clientFinishX);
- clientY = move(clientY, clientFinishY);
- this.browserbot.triggerMouseEvent(element, 'mousemove', true, clientX, clientY);
- }
-
- this.browserbot.triggerMouseEvent(element, 'mousemove', true, clientFinishX, clientFinishY);
- this.browserbot.triggerMouseEvent(element, 'mouseup', true, clientFinishX, clientFinishY);
-};
-
-Selenium.prototype.doDragAndDropToObject = function(locatorOfObjectToBeDragged, locatorOfDragDestinationObject) {
-/** Drags an element and drops it on another element
- *
- * @param locatorOfObjectToBeDragged an element to be dragged
- * @param locatorOfDragDestinationObject an element whose location (i.e., whose center-most pixel) will be the point where locatorOfObjectToBeDragged is dropped
- */
- var startX = this.getElementPositionLeft(locatorOfObjectToBeDragged);
- var startY = this.getElementPositionTop(locatorOfObjectToBeDragged);
-
- var destinationLeftX = this.getElementPositionLeft(locatorOfDragDestinationObject);
- var destinationTopY = this.getElementPositionTop(locatorOfDragDestinationObject);
- var destinationWidth = this.getElementWidth(locatorOfDragDestinationObject);
- var destinationHeight = this.getElementHeight(locatorOfDragDestinationObject);
-
- var endX = Math.round(destinationLeftX + (destinationWidth / 2));
- var endY = Math.round(destinationTopY + (destinationHeight / 2));
-
- var deltaX = endX - startX;
- var deltaY = endY - startY;
-
- var movementsString = "" + deltaX + "," + deltaY;
-
- this.doDragAndDrop(locatorOfObjectToBeDragged, movementsString);
-};
-
-Selenium.prototype.doWindowFocus = function() {
-/** Gives focus to the currently selected window
- *
- */
- this.browserbot.getCurrentWindow().focus();
-};
-
-
-Selenium.prototype.doWindowMaximize = function() {
-/** Resize currently selected window to take up the entire screen
- *
- */
- var window = this.browserbot.getCurrentWindow();
- if (window!=null && window.screen) {
- window.moveTo(0,0);
- window.resizeTo(screen.availWidth, screen.availHeight);
- }
-};
-
-Selenium.prototype.getAllWindowIds = function() {
- /** Returns the IDs of all windows that the browser knows about.
- *
- * @return string[] the IDs of all windows that the browser knows about.
- */
- return this.getAttributeFromAllWindows("id");
-};
-
-Selenium.prototype.getAllWindowNames = function() {
- /** Returns the names of all windows that the browser knows about.
- *
- * @return string[] the names of all windows that the browser knows about.
- */
- return this.getAttributeFromAllWindows("name");
-};
-
-Selenium.prototype.getAllWindowTitles = function() {
- /** Returns the titles of all windows that the browser knows about.
- *
- * @return string[] the titles of all windows that the browser knows about.
- */
- return this.getAttributeFromAllWindows("document.title");
-};
-
-Selenium.prototype.getHtmlSource = function() {
- /** Returns the entire HTML source between the opening and
- * closing "html" tags.
- *
- * @return string the entire HTML source
- */
- return this.browserbot.getDocument().getElementsByTagName("html")[0].innerHTML;
-};
-
-Selenium.prototype.doSetCursorPosition = function(locator, position) {
- /**
- * Moves the text cursor to the specified position in the given input element or textarea.
- * This method will fail if the specified element isn't an input element or textarea.
- *
- * @param locator an element locator pointing to an input element or textarea
- * @param position the numerical position of the cursor in the field; position should be 0 to move the position to the beginning of the field. You can also set the cursor to -1 to move it to the end of the field.
- */
- var element = this.browserbot.findElement(locator);
- if (element.value == undefined) {
- Assert.fail("Element " + locator + " is not an input.");
- }
- if (position == -1) {
- position = element.value.length;
- }
-
- if( element.setSelectionRange && !browserVersion.isOpera) {
- element.focus();
- element.setSelectionRange(/*start*/position,/*end*/position);
- }
- else if( element.createTextRange ) {
- triggerEvent(element, 'focus', false);
- var range = element.createTextRange();
- range.collapse(true);
- range.moveEnd('character',position);
- range.moveStart('character',position);
- range.select();
- }
-}
-
-Selenium.prototype.getElementIndex = function(locator) {
- /**
- * Get the relative index of an element to its parent (starting from 0). The comment node and empty text node
- * will be ignored.
- *
- * @param locator an element locator pointing to an element
- * @return number of relative index of the element to its parent (starting from 0)
- */
- var element = this.browserbot.findElement(locator);
- var previousSibling;
- var index = 0;
- while ((previousSibling = element.previousSibling) != null) {
- if (!this._isCommentOrEmptyTextNode(previousSibling)) {
- index++;
- }
- element = previousSibling;
- }
- return index;
-}
-
-Selenium.prototype.isOrdered = function(locator1, locator2) {
- /**
- * Check if these two elements have same parent and are ordered siblings in the DOM. Two same elements will
- * not be considered ordered.
- *
- * @param locator1 an element locator pointing to the first element
- * @param locator2 an element locator pointing to the second element
- * @return boolean true if element1 is the previous sibling of element2, false otherwise
- */
- var element1 = this.browserbot.findElement(locator1);
- var element2 = this.browserbot.findElement(locator2);
- if (element1 === element2) return false;
-
- var previousSibling;
- while ((previousSibling = element2.previousSibling) != null) {
- if (previousSibling === element1) {
- return true;
- }
- element2 = previousSibling;
- }
- return false;
-}
-
-Selenium.prototype._isCommentOrEmptyTextNode = function(node) {
- return node.nodeType == 8 || ((node.nodeType == 3) && !(/[^\t\n\r ]/.test(node.data)));
-}
-
-Selenium.prototype.getElementPositionLeft = function(locator) {
- /**
- * Retrieves the horizontal position of an element
- *
- * @param locator an element locator pointing to an element OR an element itself
- * @return number of pixels from the edge of the frame.
- */
- var element;
- if ("string"==typeof locator) {
- element = this.browserbot.findElement(locator);
- }
- else {
- element = locator;
- }
- var x = element.offsetLeft;
- var elementParent = element.offsetParent;
-
- while (elementParent != null)
- {
- if(document.all)
- {
- if( (elementParent.tagName != "TABLE") && (elementParent.tagName != "BODY") )
- {
- x += elementParent.clientLeft;
- }
- }
- else // Netscape/DOM
- {
- if(elementParent.tagName == "TABLE")
- {
- var parentBorder = parseInt(elementParent.border);
- if(isNaN(parentBorder))
- {
- var parentFrame = elementParent.getAttribute('frame');
- if(parentFrame != null)
- {
- x += 1;
- }
- }
- else if(parentBorder > 0)
- {
- x += parentBorder;
- }
- }
- }
- x += elementParent.offsetLeft;
- elementParent = elementParent.offsetParent;
- }
- return x;
-};
-
-Selenium.prototype.getElementPositionTop = function(locator) {
- /**
- * Retrieves the vertical position of an element
- *
- * @param locator an element locator pointing to an element OR an element itself
- * @return number of pixels from the edge of the frame.
- */
- var element;
- if ("string"==typeof locator) {
- element = this.browserbot.findElement(locator);
- }
- else {
- element = locator;
- }
-
- var y = 0;
-
- while (element != null)
- {
- if(document.all)
- {
- if( (element.tagName != "TABLE") && (element.tagName != "BODY") )
- {
- y += element.clientTop;
- }
- }
- else // Netscape/DOM
- {
- if(element.tagName == "TABLE")
- {
- var parentBorder = parseInt(element.border);
- if(isNaN(parentBorder))
- {
- var parentFrame = element.getAttribute('frame');
- if(parentFrame != null)
- {
- y += 1;
- }
- }
- else if(parentBorder > 0)
- {
- y += parentBorder;
- }
- }
- }
- y += element.offsetTop;
-
- // Netscape can get confused in some cases, such that the height of the parent is smaller
- // than that of the element (which it shouldn't really be). If this is the case, we need to
- // exclude this element, since it will result in too large a 'top' return value.
- if (element.offsetParent && element.offsetParent.offsetHeight && element.offsetParent.offsetHeight < element.offsetHeight)
- {
- // skip the parent that's too small
- element = element.offsetParent.offsetParent;
- }
- else
- {
- // Next up...
- element = element.offsetParent;
- }
- }
- return y;
-};
-
-Selenium.prototype.getElementWidth = function(locator) {
- /**
- * Retrieves the width of an element
- *
- * @param locator an element locator pointing to an element
- * @return number width of an element in pixels
- */
- var element = this.browserbot.findElement(locator);
- return element.offsetWidth;
-};
-
-Selenium.prototype.getElementHeight = function(locator) {
- /**
- * Retrieves the height of an element
- *
- * @param locator an element locator pointing to an element
- * @return number height of an element in pixels
- */
- var element = this.browserbot.findElement(locator);
- return element.offsetHeight;
-};
-
-Selenium.prototype.getCursorPosition = function(locator) {
- /**
- * Retrieves the text cursor position in the given input element or textarea; beware, this may not work perfectly on all browsers.
- *
- * Specifically, if the cursor/selection has been cleared by JavaScript, this command will tend to
- * return the position of the last location of the cursor, even though the cursor is now gone from the page. This is filed as SEL-243.
- * This method will fail if the specified element isn't an input element or textarea, or there is no cursor in the element.
- *
- * @param locator an element locator pointing to an input element or textarea
- * @return number the numerical position of the cursor in the field
- */
- var element = this.browserbot.findElement(locator);
- var doc = this.browserbot.getDocument();
- var win = this.browserbot.getCurrentWindow();
- if( doc.selection && !browserVersion.isOpera){
- try {
- var selectRange = doc.selection.createRange().duplicate();
- var elementRange = element.createTextRange();
- selectRange.move("character",0);
- elementRange.move("character",0);
- var inRange1 = selectRange.inRange(elementRange);
- var inRange2 = elementRange.inRange(selectRange);
- elementRange.setEndPoint("EndToEnd", selectRange);
- } catch (e) {
- Assert.fail("There is no cursor on this page!");
- }
- var answer = String(elementRange.text).replace(/\r/g,"").length;
- return answer;
- } else {
- if (typeof(element.selectionStart) != "undefined") {
- if (win.getSelection && typeof(win.getSelection().rangeCount) != undefined && win.getSelection().rangeCount == 0) {
- Assert.fail("There is no cursor on this page!");
- }
- return element.selectionStart;
- }
- }
- throw new Error("Couldn't detect cursor position on this browser!");
-}
-
-
-Selenium.prototype.getExpression = function(expression) {
- /**
- * Returns the specified expression.
- *
- * This is useful because of JavaScript preprocessing.
- * It is used to generate commands like assertExpression and waitForExpression.
- *
- * @param expression the value to return
- * @return string the value passed in
- */
- return expression;
-}
-
-Selenium.prototype.getXpathCount = function(xpath) {
- /**
- * Returns the number of nodes that match the specified xpath, eg. "//table" would give
- * the number of tables.
- *
- * @param xpath the xpath expression to evaluate. do NOT wrap this expression in a 'count()' function; we will do that for you.
- * @return number the number of nodes that match the specified xpath
- */
- var result = this.browserbot.evaluateXPathCount(xpath, this.browserbot.getDocument());
- return result;
-}
-
-Selenium.prototype.doAssignId = function(locator, identifier) {
- /**
- * Temporarily sets the "id" attribute of the specified element, so you can locate it in the future
- * using its ID rather than a slow/complicated XPath. This ID will disappear once the page is
- * reloaded.
- * @param locator an element locator pointing to an element
- * @param identifier a string to be used as the ID of the specified element
- */
- var element = this.browserbot.findElement(locator);
- element.id = identifier;
-}
-
-Selenium.prototype.doAllowNativeXpath = function(allow) {
- /**
- * Specifies whether Selenium should use the native in-browser implementation
- * of XPath (if any native version is available); if you pass "false" to
- * this function, we will always use our pure-JavaScript xpath library.
- * Using the pure-JS xpath library can improve the consistency of xpath
- * element locators between different browser vendors, but the pure-JS
- * version is much slower than the native implementations.
- * @param allow boolean, true means we'll prefer to use native XPath; false means we'll only use JS XPath
- */
- if ("false" == allow || "0" == allow) { // The strings "false" and "0" are true values in JS
- allow = false;
- }
- this.browserbot.allowNativeXpath = allow;
-}
-
-Selenium.prototype.doIgnoreAttributesWithoutValue = function(ignore) {
- /**
- * Specifies whether Selenium will ignore xpath attributes that have no
- * value, i.e. are the empty string, when using the non-native xpath
- * evaluation engine. You'd want to do this for performance reasons in IE.
- * However, this could break certain xpaths, for example an xpath that looks
- * for an attribute whose value is NOT the empty string.
- *
- * The hope is that such xpaths are relatively rare, but the user should
- * have the option of using them. Note that this only influences xpath
- * evaluation when using the ajaxslt engine (i.e. not "javascript-xpath").
- *
- * @param ignore boolean, true means we'll ignore attributes without value
- * at the expense of xpath "correctness"; false means
- * we'll sacrifice speed for correctness.
- */
- if ('false' == ignore || '0' == ignore) {
- ignore = false;
- }
- this.browserbot.ignoreAttributesWithoutValue = ignore;
-}
-
-Selenium.prototype.doWaitForCondition = function(script, timeout) {
- /**
- * Runs the specified JavaScript snippet repeatedly until it evaluates to "true".
- * The snippet may have multiple lines, but only the result of the last line
- * will be considered.
- *
- * Note that, by default, the snippet will be run in the runner's test window, not in the window
- * of your application. To get the window of your application, you can use
- * the JavaScript snippet selenium.browserbot.getCurrentWindow(), and then
- * run your JavaScript in there
- * @param script the JavaScript snippet to run
- * @param timeout a timeout in milliseconds, after which this command will return with an error
- */
-
- return Selenium.decorateFunctionWithTimeout(function () {
- var window = selenium.browserbot.getCurrentWindow();
- return eval(script);
- }, timeout);
-};
-
-Selenium.prototype.doWaitForCondition.dontCheckAlertsAndConfirms = true;
-
-Selenium.prototype.doSetTimeout = function(timeout) {
- /**
- * Specifies the amount of time that Selenium will wait for actions to complete.
- *
- * Actions that require waiting include "open" and the "waitFor*" actions.
- * The default timeout is 30 seconds.
- * @param timeout a timeout in milliseconds, after which the action will return with an error
- */
- if (!timeout) {
- timeout = Selenium.DEFAULT_TIMEOUT;
- }
- this.defaultTimeout = timeout;
-}
-
-Selenium.prototype.doWaitForPageToLoad = function(timeout) {
- /**
- * Waits for a new page to load.
- *
- * You can use this command instead of the "AndWait" suffixes, "clickAndWait", "selectAndWait", "typeAndWait" etc.
- * (which are only available in the JS API).
- *
- * Selenium constantly keeps track of new pages loading, and sets a "newPageLoaded"
- * flag when it first notices a page load. Running any other Selenium command after
- * turns the flag to false. Hence, if you want to wait for a page to load, you must
- * wait immediately after a Selenium command that caused a page-load.
- * @param timeout a timeout in milliseconds, after which this command will return with an error
- */
- // in pi-mode, the test and the harness share the window; thus if we are executing this code, then we have loaded
- if (window["proxyInjectionMode"] == null || !window["proxyInjectionMode"]) {
- return this.makePageLoadCondition(timeout);
- }
-};
-
-Selenium.prototype.doWaitForFrameToLoad = function(frameAddress, timeout) {
- /**
- * Waits for a new frame to load.
- *
- * Selenium constantly keeps track of new pages and frames loading,
- * and sets a "newPageLoaded" flag when it first notices a page load.
- *
- * See waitForPageToLoad for more information.
- *
- * @param frameAddress FrameAddress from the server side
- * @param timeout a timeout in milliseconds, after which this command will return with an error
- */
- // in pi-mode, the test and the harness share the window; thus if we are executing this code, then we have loaded
- if (window["proxyInjectionMode"] == null || !window["proxyInjectionMode"]) {
- return this.makePageLoadCondition(timeout);
- }
-};
-
-Selenium.prototype._isNewPageLoaded = function() {
- return this.browserbot.isNewPageLoaded();
-};
-
-Selenium.prototype.doWaitForPageToLoad.dontCheckAlertsAndConfirms = true;
-
-/**
- * Evaluate a parameter, performing JavaScript evaluation and variable substitution.
- * If the string matches the pattern "javascript{ ... }", evaluate the string between the braces.
- */
-Selenium.prototype.preprocessParameter = function(value) {
- var match = value.match(/^javascript\{((.|\r?\n)+)\}$/);
- if (match && match[1]) {
- return eval(match[1]).toString();
- }
- return this.replaceVariables(value);
-};
-
-/*
- * Search through str and replace all variable references ${varName} with their
- * value in storedVars.
- */
-Selenium.prototype.replaceVariables = function(str) {
- var stringResult = str;
-
- // Find all of the matching variable references
- var match = stringResult.match(/\$\{\w+\}/g);
- if (!match) {
- return stringResult;
- }
-
- // For each match, lookup the variable value, and replace if found
- for (var i = 0; match && i < match.length; i++) {
- var variable = match[i]; // The replacement variable, with ${}
- var name = variable.substring(2, variable.length - 1); // The replacement variable without ${}
- var replacement = storedVars[name];
- if (replacement != undefined) {
- stringResult = stringResult.replace(variable, replacement);
- }
- }
- return stringResult;
-};
-
-Selenium.prototype.getCookie = function() {
- /**
- * Return all cookies of the current page under test.
- *
- * @return string all cookies of the current page under test
- */
- var doc = this.browserbot.getDocument();
- return doc.cookie;
-};
-
-Selenium.prototype.getCookieByName = function(name) {
- /**
- * Returns the value of the cookie with the specified name, or throws an error if the cookie is not present.
- * @param name the name of the cookie
- * @return string the value of the cookie
- */
- var v = this.browserbot.getCookieByName(name);
- if (v === null) {
- throw new SeleniumError("Cookie '"+name+"' was not found");
- }
- return v;
-};
-
-Selenium.prototype.isCookiePresent = function(name) {
- /**
- * Returns true if a cookie with the specified name is present, or false otherwise.
- * @param name the name of the cookie
- * @return boolean true if a cookie with the specified name is present, or false otherwise.
- */
- var v = this.browserbot.getCookieByName(name);
- var absent = (v === null);
- return !absent;
-}
-
-Selenium.prototype.doCreateCookie = function(nameValuePair, optionsString) {
- /**
- * Create a new cookie whose path and domain are same with those of current page
- * under test, unless you specified a path for this cookie explicitly.
- *
- * @param nameValuePair name and value of the cookie in a format "name=value"
- * @param optionsString options for the cookie. Currently supported options include 'path', 'max_age' and 'domain'.
- * the optionsString's format is "path=/path/, max_age=60, domain=.foo.com". The order of options are irrelevant, the unit
- * of the value of 'max_age' is second. Note that specifying a domain that isn't a subset of the current domain will
- * usually fail.
- */
- var results = /[^\s=\[\]\(\),"\/\?@:;]+=[^\s=\[\]\(\),"\/\?@:;]*/.test(nameValuePair);
- if (!results) {
- throw new SeleniumError("Invalid parameter.");
- }
- var cookie = nameValuePair.trim();
- results = /max_age=(\d+)/.exec(optionsString);
- if (results) {
- var expireDateInMilliseconds = (new Date()).getTime() + results[1] * 1000;
- cookie += "; expires=" + new Date(expireDateInMilliseconds).toGMTString();
- }
- results = /path=([^\s,]+)[,]?/.exec(optionsString);
- if (results) {
- var path = results[1];
- if (browserVersion.khtml) {
- // Safari and conquerer don't like paths with / at the end
- if ("/" != path) {
- path = path.replace(/\/$/, "");
- }
- }
- cookie += "; path=" + path;
- }
- results = /domain=([^\s,]+)[,]?/.exec(optionsString);
- if (results) {
- var domain = results[1];
- cookie += "; domain=" + domain;
- }
- LOG.debug("Setting cookie to: " + cookie);
- this.browserbot.getDocument().cookie = cookie;
-}
-
-Selenium.prototype.doDeleteCookie = function(name,optionsString) {
- /**
- * Delete a named cookie with specified path and domain. Be careful; to delete a cookie, you
- * need to delete it using the exact same path and domain that were used to create the cookie.
- * If the path is wrong, or the domain is wrong, the cookie simply won't be deleted. Also
- * note that specifying a domain that isn't a subset of the current domain will usually fail.
- *
- * Since there's no way to discover at runtime the original path and domain of a given cookie,
- * we've added an option called 'recurse' to try all sub-domains of the current domain with
- * all paths that are a subset of the current path. Beware; this option can be slow. In
- * big-O notation, it operates in O(n*m) time, where n is the number of dots in the domain
- * name and m is the number of slashes in the path.
- *
- * @param name the name of the cookie to be deleted
- * @param optionsString options for the cookie. Currently supported options include 'path', 'domain'
- * and 'recurse.' The optionsString's format is "path=/path/, domain=.foo.com, recurse=true".
- * The order of options are irrelevant. Note that specifying a domain that isn't a subset of
- * the current domain will usually fail.
- */
- // set the expire time of the cookie to be deleted to one minute before now.
- var path = "";
- var domain = "";
- var recurse = false;
- var matched = false;
- results = /path=([^\s,]+)[,]?/.exec(optionsString);
- if (results) {
- matched = true;
- path = results[1];
- }
- results = /domain=([^\s,]+)[,]?/.exec(optionsString);
- if (results) {
- matched = true;
- domain = results[1];
- }
- results = /recurse=([^\s,]+)[,]?/.exec(optionsString);
- if (results) {
- matched = true;
- recurse = results[1];
- if ("false" == recurse) {
- recurse = false;
- }
- }
- // Treat the entire optionsString as a path (for backwards compatibility)
- if (optionsString && !matched) {
- LOG.warn("Using entire optionsString as a path; please change the argument to deleteCookie to use path="+optionsString);
- path = optionsString;
- }
- if (browserVersion.khtml) {
- // Safari and conquerer don't like paths with / at the end
- if ("/" != path) {
- path = path.replace(/\/$/, "");
- }
- }
- path = path.trim();
- domain = domain.trim();
- var cookieName = name.trim();
- if (recurse) {
- this.browserbot.recursivelyDeleteCookie(cookieName, domain, path);
- } else {
- this.browserbot.deleteCookie(cookieName, domain, path);
- }
-}
-
-Selenium.prototype.doDeleteAllVisibleCookies = function() {
- /** Calls deleteCookie with recurse=true on all cookies visible to the current page.
- * As noted on the documentation for deleteCookie, recurse=true can be much slower
- * than simply deleting the cookies using a known domain/path.
- */
- var win = this.browserbot.getCurrentWindow();
- var doc = win.document;
- var cookieNames = this.browserbot.getAllCookieNames(doc);
- var domain = doc.domain;
- var path = win.location.pathname;
- for (var i = 0; i < cookieNames.length; i++) {
- this.browserbot.recursivelyDeleteCookie(cookieNames[i], domain, path, win);
- }
-}
-
-Selenium.prototype.doSetBrowserLogLevel = function(logLevel) {
- /**
- * Sets the threshold for browser-side logging messages; log messages beneath this threshold will be discarded.
- * Valid logLevel strings are: "debug", "info", "warn", "error" or "off".
- * To see the browser logs, you need to
- * either show the log window in GUI mode, or enable browser-side logging in Selenium RC.
- *
- * @param logLevel one of the following: "debug", "info", "warn", "error" or "off"
- */
- if (logLevel == null || logLevel == "") {
- throw new SeleniumError("You must specify a log level");
- }
- logLevel = logLevel.toLowerCase();
- if (LOG.logLevels[logLevel] == null) {
- throw new SeleniumError("Invalid log level: " + logLevel);
- }
- LOG.setLogLevelThreshold(logLevel);
-}
-
-Selenium.prototype.doRunScript = function(script) {
- /**
- * Creates a new "script" tag in the body of the current test window, and
- * adds the specified text into the body of the command. Scripts run in
- * this way can often be debugged more easily than scripts executed using
- * Selenium's "getEval" command. Beware that JS exceptions thrown in these script
- * tags aren't managed by Selenium, so you should probably wrap your script
- * in try/catch blocks if there is any chance that the script will throw
- * an exception.
- * @param script the JavaScript snippet to run
- */
- var win = this.browserbot.getCurrentWindow();
- var doc = win.document;
- var scriptTag = doc.createElement("script");
- scriptTag.type = "text/javascript"
- scriptTag.text = script;
- doc.body.appendChild(scriptTag);
-}
-
-Selenium.prototype.doAddLocationStrategy = function(strategyName, functionDefinition) {
- /**
- * Defines a new function for Selenium to locate elements on the page.
- * For example,
- * if you define the strategy "foo", and someone runs click("foo=blah"), we'll
- * run your function, passing you the string "blah", and click on the element
- * that your function
- * returns, or throw an "Element not found" error if your function returns null.
- *
- * We'll pass three arguments to your function:
- *
- * - locator: the string the user passed in
- * - inWindow: the currently selected window
- * - inDocument: the currently selected document
- *
- * The function must return null if the element can't be found.
- *
- * @param strategyName the name of the strategy to define; this should use only
- * letters [a-zA-Z] with no spaces or other punctuation.
- * @param functionDefinition a string defining the body of a function in JavaScript.
- * For example: return inDocument.getElementById(locator);
- */
- if (!/^[a-zA-Z]+$/.test(strategyName)) {
- throw new SeleniumError("Invalid strategy name: " + strategyName);
- }
- var strategyFunction;
- try {
- strategyFunction = new Function("locator", "inDocument", "inWindow", functionDefinition);
- } catch (ex) {
- throw new SeleniumError("Error evaluating function definition: " + extractExceptionMessage(ex));
- }
- var safeStrategyFunction = function() {
- try {
- return strategyFunction.apply(this, arguments);
- } catch (ex) {
- throw new SeleniumError("Error executing strategy function " + strategyName + ": " + extractExceptionMessage(ex));
- }
- }
- this.browserbot.locationStrategies[strategyName] = safeStrategyFunction;
-}
-
-Selenium.prototype.doCaptureEntirePageScreenshot = function(filename, kwargs) {
- /**
- * Saves the entire contents of the current window canvas to a PNG file.
- * Contrast this with the captureScreenshot command, which captures the
- * contents of the OS viewport (i.e. whatever is currently being displayed
- * on the monitor), and is implemented in the RC only. Currently this only
- * works in Firefox when running in chrome mode, and in IE non-HTA using
- * the EXPERIMENTAL "Snapsie" utility. The Firefox implementation is mostly
- * borrowed from the Screengrab! Firefox extension. Please see
- * http://www.screengrab.org and http://snapsie.sourceforge.net/ for
- * details.
- *
- * @param filename the path to the file to persist the screenshot as. No
- * filename extension will be appended by default.
- * Directories will not be created if they do not exist,
- * and an exception will be thrown, possibly by native
- * code.
- * @param kwargs a kwargs string that modifies the way the screenshot
- * is captured. Example: "background=#CCFFDD" .
- * Currently valid options:
- *
- * - background
- * - the background CSS for the HTML document. This
- * may be useful to set for capturing screenshots of
- * less-than-ideal layouts, for example where absolute
- * positioning causes the calculation of the canvas
- * dimension to fail and a black background is exposed
- * (possibly obscuring black text).
- *
- */
- if (! browserVersion.isChrome &&
- ! (browserVersion.isIE && ! browserVersion.isHTA)) {
- throw new SeleniumError('captureEntirePageScreenshot is only '
- + 'implemented for Firefox ("firefox" or "chrome", NOT '
- + '"firefoxproxy") and IE non-HTA ("iexploreproxy", NOT "iexplore" '
- + 'or "iehta"). The current browser isn\'t one of them!');
- }
-
- // do or do not ... there is no try
-
- if (browserVersion.isIE) {
- // targeting snapsIE >= 0.2
- function getFailureMessage(exceptionMessage) {
- var msg = 'Snapsie failed: ';
- if (exceptionMessage) {
- if (exceptionMessage ==
- "Automation server can't create object") {
- msg += 'Is it installed? Does it have permission to run '
- 'as an add-on? See http://snapsie.sourceforge.net/';
- }
- else {
- msg += exceptionMessage;
- }
- }
- else {
- msg += 'Undocumented error';
- }
- return msg;
- }
-
- if (typeof(runOptions) != 'undefined' &&
- runOptions.isMultiWindowMode() == false) {
- // framed mode
- try {
- new Snapsie().saveSnapshot(filename, 'selenium_myiframe');
- }
- catch (e) {
- throw new SeleniumError(getFailureMessage(e.message));
- }
- }
- else {
- // multi-window mode
- if (!this.snapsieSrc) {
- // XXX - cache snapsie, and capture the screenshot as a
- // callback. Definitely a hack, because we may be late taking
- // the first screenshot, but saves us from polluting other code
- // for now. I wish there were an easier way to get at the
- // contents of a referenced script!
- var snapsieUrl = (this.browserbot.buttonWindow.location.href)
- .replace(/(Test|Remote)Runner\.html/, 'lib/snapsie.js');
- var self = this;
- new Ajax.Request(snapsieUrl, {
- method: 'get'
- , onSuccess: function(transport) {
- self.snapsieSrc = transport.responseText;
- self.doCaptureEntirePageScreenshot(filename, kwargs);
- }
- });
- return;
- }
-
- // it's going into a string, so escape the backslashes
- filename = filename.replace(/\\/g, '\\\\');
-
- // this is sort of hackish. We insert a script into the document,
- // and remove it before anyone notices.
- var doc = selenium.browserbot.getDocument();
- var script = doc.createElement('script');
- var scriptContent = this.snapsieSrc
- + 'try {'
- + ' new Snapsie().saveSnapshot("' + filename + '");'
- + '}'
- + 'catch (e) {'
- + ' document.getElementById("takeScreenshot").failure ='
- + ' e.message;'
- + '}';
- script.id = 'takeScreenshot';
- script.language = 'javascript';
- script.text = scriptContent;
- doc.body.appendChild(script);
- script.parentNode.removeChild(script);
- if (script.failure) {
- throw new SeleniumError(getFailureMessage(script.failure));
- }
- }
- return;
- }
-
- var grabber = {
- prepareCanvas: function(width, height) {
- var styleWidth = width + 'px';
- var styleHeight = height + 'px';
-
- var grabCanvas = document.getElementById('screenshot_canvas');
- if (!grabCanvas) {
- // create the canvas
- var ns = 'http://www.w3.org/1999/xhtml';
- grabCanvas = document.createElementNS(ns, 'html:canvas');
- grabCanvas.id = 'screenshot_canvas';
- grabCanvas.style.display = 'none';
- document.documentElement.appendChild(grabCanvas);
- }
-
- grabCanvas.width = width;
- grabCanvas.style.width = styleWidth;
- grabCanvas.style.maxWidth = styleWidth;
- grabCanvas.height = height;
- grabCanvas.style.height = styleHeight;
- grabCanvas.style.maxHeight = styleHeight;
-
- return grabCanvas;
- },
-
- prepareContext: function(canvas, box) {
- var context = canvas.getContext('2d');
- context.clearRect(box.x, box.y, box.width, box.height);
- context.save();
- return context;
- }
- };
-
- var SGNsUtils = {
- dataUrlToBinaryInputStream: function(dataUrl) {
- var nsIoService = Components.classes["@mozilla.org/network/io-service;1"]
- .getService(Components.interfaces.nsIIOService);
- var channel = nsIoService
- .newChannelFromURI(nsIoService.newURI(dataUrl, null, null));
- var binaryInputStream = Components.classes["@mozilla.org/binaryinputstream;1"]
- .createInstance(Components.interfaces.nsIBinaryInputStream);
-
- binaryInputStream.setInputStream(channel.open());
- return binaryInputStream;
- },
-
- newFileOutputStream: function(nsFile) {
- var writeFlag = 0x02; // write only
- var createFlag = 0x08; // create
- var truncateFlag = 0x20; // truncate
- var fileOutputStream = Components.classes["@mozilla.org/network/file-output-stream;1"]
- .createInstance(Components.interfaces.nsIFileOutputStream);
-
- fileOutputStream.init(nsFile,
- writeFlag | createFlag | truncateFlag, 0664, null);
- return fileOutputStream;
- },
-
- writeBinaryInputStreamToFileOutputStream:
- function(binaryInputStream, fileOutputStream) {
- var numBytes = binaryInputStream.available();
- var bytes = binaryInputStream.readBytes(numBytes);
- fileOutputStream.write(bytes, numBytes);
- }
- };
-
- // compute dimensions
- var window = this.browserbot.getCurrentWindow();
- var doc = window.document.documentElement;
- var box = {
- x: 0,
- y: 0,
- width: doc.scrollWidth,
- height: doc.scrollHeight
- };
- LOG.debug('computed dimensions');
-
- var originalBackground = doc.style.background;
-
- if (kwargs) {
- var args = parse_kwargs(kwargs);
- if (args.background) {
- doc.style.background = args.background;
- }
- }
-
- // grab
- var format = 'png';
- var canvas = grabber.prepareCanvas(box.width, box.height);
- var context = grabber.prepareContext(canvas, box);
- context.drawWindow(window, box.x, box.y, box.width, box.height,
- 'rgb(0, 0, 0)');
- context.restore();
- var dataUrl = canvas.toDataURL("image/" + format);
- LOG.debug('grabbed to canvas');
-
- doc.style.background = originalBackground;
-
- // save to file
- var nsFile = Components.classes["@mozilla.org/file/local;1"]
- .createInstance(Components.interfaces.nsILocalFile);
- try {
- nsFile.initWithPath(filename);
- }
- catch (e) {
- if (/NS_ERROR_FILE_UNRECOGNIZED_PATH/.test(e.message)) {
- // try using the opposite file separator
- if (filename.indexOf('/') != -1) {
- filename = filename.replace(/\//g, '\\');
- }
- else {
- filename = filename.replace(/\\/g, '/');
- }
- nsFile.initWithPath(filename);
- }
- else {
- throw e;
- }
- }
- var binaryInputStream = SGNsUtils.dataUrlToBinaryInputStream(dataUrl);
- var fileOutputStream = SGNsUtils.newFileOutputStream(nsFile);
- SGNsUtils.writeBinaryInputStreamToFileOutputStream(binaryInputStream,
- fileOutputStream);
- fileOutputStream.close();
- LOG.debug('saved to file');
-};
-
-Selenium.prototype.doRollup = function(rollupName, kwargs) {
- /**
- * Executes a command rollup, which is a series of commands with a unique
- * name, and optionally arguments that control the generation of the set of
- * commands. If any one of the rolled-up commands fails, the rollup is
- * considered to have failed. Rollups may also contain nested rollups.
- *
- * @param rollupName the name of the rollup command
- * @param kwargs keyword arguments string that influences how the
- * rollup expands into commands
- */
- // we have to temporarily hijack the commandStarted, nextCommand(),
- // commandComplete(), and commandError() methods of the TestLoop object.
- // When the expanded rollup commands are done executing (or an error has
- // occurred), we'll restore them to their original values.
- var loop = currentTest || htmlTestRunner.currentTest;
- var backupManager = {
- backup: function() {
- for (var item in this.data) {
- this.data[item] = loop[item];
- }
- }
- , restore: function() {
- for (var item in this.data) {
- loop[item] = this.data[item];
- }
- }
- , data: {
- requiresCallBack: null
- , commandStarted: null
- , nextCommand: null
- , commandComplete: null
- , commandError: null
- , pendingRollupCommands: null
- , rollupFailed: null
- , rollupFailedMessage: null
- }
- };
-
- var rule = RollupManager.getInstance().getRollupRule(rollupName);
- var expandedCommands = rule.getExpandedCommands(kwargs);
-
- // hold your breath ...
- try {
- backupManager.backup();
- loop.requiresCallBack = false;
- loop.commandStarted = function() {};
- loop.nextCommand = function() {
- if (this.pendingRollupCommands.length == 0) {
- return null;
- }
- var command = this.pendingRollupCommands.shift();
- return command;
- };
- loop.commandComplete = function(result) {
- if (result.failed) {
- this.rollupFailed = true;
- this.rollupFailureMessages.push(result.failureMessage);
- }
-
- if (this.pendingRollupCommands.length == 0) {
- result = {
- failed: this.rollupFailed
- , failureMessage: this.rollupFailureMessages.join('; ')
- };
- LOG.info('Rollup execution complete: ' + (result.failed
- ? 'failed! (see error messages below)' : 'ok'));
- backupManager.restore();
- this.commandComplete(result);
- }
- };
- loop.commandError = function(errorMessage) {
- LOG.info('Rollup execution complete: bombed!');
- backupManager.restore();
- this.commandError(errorMessage);
- };
-
- loop.pendingRollupCommands = expandedCommands;
- loop.rollupFailed = false;
- loop.rollupFailureMessages = [];
- }
- catch (e) {
- LOG.error('Rollup error: ' + e);
- backupManager.restore();
- }
-};
-
-Selenium.prototype.doAddScript = function(scriptContent, scriptTagId) {
- /**
- * Loads script content into a new script tag in the Selenium document. This
- * differs from the runScript command in that runScript adds the script tag
- * to the document of the AUT, not the Selenium document. The following
- * entities in the script content are replaced by the characters they
- * represent:
- *
- * <
- * >
- * &
- *
- * The corresponding remove command is removeScript.
- *
- * @param scriptContent the Javascript content of the script to add
- * @param scriptTagId (optional) the id of the new script tag. If
- * specified, and an element with this id already
- * exists, this operation will fail.
- */
- if (scriptTagId && document.getElementById(scriptTagId)) {
- var msg = "Element with id '" + scriptTagId + "' already exists!";
- throw new SeleniumError(msg);
- }
-
- var head = document.getElementsByTagName('head')[0];
- var script = document.createElement('script');
-
- script.type = 'text/javascript';
-
- if (scriptTagId) {
- script.id = scriptTagId;
- }
-
- // replace some entities
- scriptContent = scriptContent
- .replace(/</g, '<')
- .replace(/>/g, '>')
- .replace(/&/g, '&');
-
- script.text = scriptContent;
- head.appendChild(script);
-};
-
-Selenium.prototype.doRemoveScript = function(scriptTagId) {
- /**
- * Removes a script tag from the Selenium document identified by the given
- * id. Does nothing if the referenced tag doesn't exist.
- *
- * @param scriptTagId the id of the script element to remove.
- */
- var script = document.getElementById(scriptTagId);
-
- if (script && getTagName(script) == 'script') {
- script.parentNode.removeChild(script);
- }
-};
-
-Selenium.prototype.doUseXpathLibrary = function(libraryName) {
- /**
- * Allows choice of one of the available libraries.
- * @param libraryName name of the desired library
- * Only the following three can be chosen:
- * ajaxslt - Google's library
- * javascript - Cybozu Labs' faster library
- * default - The default library. Currently the default library is ajaxslt.
- * If libraryName isn't one of these three, then
- * no change will be made.
- *
- */
-
- if (libraryName == "default") {
- this.browserbot.xpathLibrary = this.browserbot.defaultXpathLibrary;
- return;
- }
-
- if ((libraryName != 'ajaxslt') && (libraryName != 'javascript-xpath')) {
- return;
- }
-
- this.browserbot.xpathLibrary = libraryName;
-
-};
-
-/**
- * Factory for creating "Option Locators".
- * An OptionLocator is an object for dealing with Select options (e.g. for
- * finding a specified option, or asserting that the selected option of
- * Select element matches some condition.
- * The type of locator returned by the factory depends on the locator string:
- * label= (OptionLocatorByLabel)
- * value= (OptionLocatorByValue)
- * index= (OptionLocatorByIndex)
- * id= (OptionLocatorById)
- * (default is OptionLocatorByLabel).
- */
-function OptionLocatorFactory() {
-}
-
-OptionLocatorFactory.prototype.fromLocatorString = function(locatorString) {
- var locatorType = 'label';
- var locatorValue = locatorString;
- // If there is a locator prefix, use the specified strategy
- var result = locatorString.match(/^([a-zA-Z]+)=(.*)/);
- if (result) {
- locatorType = result[1];
- locatorValue = result[2];
- }
- if (this.optionLocators == undefined) {
- this.registerOptionLocators();
- }
- if (this.optionLocators[locatorType]) {
- return new this.optionLocators[locatorType](locatorValue);
- }
- throw new SeleniumError("Unknown option locator type: " + locatorType);
-};
-
-/**
- * To allow for easy extension, all of the option locators are found by
- * searching for all methods of OptionLocatorFactory.prototype that start
- * with "OptionLocatorBy".
- * TODO: Consider using the term "Option Specifier" instead of "Option Locator".
- */
-OptionLocatorFactory.prototype.registerOptionLocators = function() {
- this.optionLocators={};
- for (var functionName in this) {
- var result = /OptionLocatorBy([A-Z].+)$/.exec(functionName);
- if (result != null) {
- var locatorName = result[1].lcfirst();
- this.optionLocators[locatorName] = this[functionName];
- }
- }
-};
-
-/**
- * OptionLocator for options identified by their labels.
- */
-OptionLocatorFactory.prototype.OptionLocatorByLabel = function(label) {
- this.label = label;
- this.labelMatcher = new PatternMatcher(this.label);
- this.findOption = function(element) {
- for (var i = 0; i < element.options.length; i++) {
- if (this.labelMatcher.matches(element.options[i].text)) {
- return element.options[i];
- }
- }
- throw new SeleniumError("Option with label '" + this.label + "' not found");
- };
-
- this.assertSelected = function(element) {
- var selectedLabel = element.options[element.selectedIndex].text;
- Assert.matches(this.label, selectedLabel)
- };
-};
-
-/**
- * OptionLocator for options identified by their values.
- */
-OptionLocatorFactory.prototype.OptionLocatorByValue = function(value) {
- this.value = value;
- this.valueMatcher = new PatternMatcher(this.value);
- this.findOption = function(element) {
- for (var i = 0; i < element.options.length; i++) {
- if (this.valueMatcher.matches(element.options[i].value)) {
- return element.options[i];
- }
- }
- throw new SeleniumError("Option with value '" + this.value + "' not found");
- };
-
- this.assertSelected = function(element) {
- var selectedValue = element.options[element.selectedIndex].value;
- Assert.matches(this.value, selectedValue)
- };
-};
-
-/**
- * OptionLocator for options identified by their index.
- */
-OptionLocatorFactory.prototype.OptionLocatorByIndex = function(index) {
- this.index = Number(index);
- if (isNaN(this.index) || this.index < 0) {
- throw new SeleniumError("Illegal Index: " + index);
- }
-
- this.findOption = function(element) {
- if (element.options.length <= this.index) {
- throw new SeleniumError("Index out of range. Only " + element.options.length + " options available");
- }
- return element.options[this.index];
- };
-
- this.assertSelected = function(element) {
- Assert.equals(this.index, element.selectedIndex);
- };
-};
-
-/**
- * OptionLocator for options identified by their id.
- */
-OptionLocatorFactory.prototype.OptionLocatorById = function(id) {
- this.id = id;
- this.idMatcher = new PatternMatcher(this.id);
- this.findOption = function(element) {
- for (var i = 0; i < element.options.length; i++) {
- if (this.idMatcher.matches(element.options[i].id)) {
- return element.options[i];
- }
- }
- throw new SeleniumError("Option with id '" + this.id + "' not found");
- };
-
- this.assertSelected = function(element) {
- var selectedId = element.options[element.selectedIndex].id;
- Assert.matches(this.id, selectedId)
- };
-};
-
diff --git a/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-browserbot.js b/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-browserbot.js
deleted file mode 100644
index c8a66aca..00000000
--- a/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-browserbot.js
+++ /dev/null
@@ -1,2300 +0,0 @@
-/*
-* Copyright 2004 ThoughtWorks, Inc
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*
-*/
-
-/*
-* This script provides the Javascript API to drive the test application contained within
-* a Browser Window.
-* TODO:
-* Add support for more events (keyboard and mouse)
-* Allow to switch "user-entry" mode from mouse-based to keyboard-based, firing different
-* events in different modes.
-*/
-
-// The window to which the commands will be sent. For example, to click on a
-// popup window, first select that window, and then do a normal click command.
-var BrowserBot = function(topLevelApplicationWindow) {
- this.topWindow = topLevelApplicationWindow;
- this.topFrame = this.topWindow;
- this.baseUrl=window.location.href;
-
- // the buttonWindow is the Selenium window
- // it contains the Run/Pause buttons... this should *not* be the AUT window
- this.buttonWindow = window;
- this.currentWindow = this.topWindow;
- this.currentWindowName = null;
- this.allowNativeXpath = true;
- this.xpathLibrary = this.defaultXpathLibrary = 'ajaxslt' // change to "javascript-xpath" for the newer, faster engine
-
- // We need to know this in advance, in case the frame closes unexpectedly
- this.isSubFrameSelected = false;
-
- this.altKeyDown = false;
- this.controlKeyDown = false;
- this.shiftKeyDown = false;
- this.metaKeyDown = false;
-
- this.modalDialogTest = null;
- this.recordedAlerts = new Array();
- this.recordedConfirmations = new Array();
- this.recordedPrompts = new Array();
- this.openedWindows = {};
- this.nextConfirmResult = true;
- this.nextPromptResult = '';
- this.newPageLoaded = false;
- this.pageLoadError = null;
-
- this.shouldHighlightLocatedElement = false;
-
- this.uniqueId = "seleniumMarker" + new Date().getTime();
- this.pollingForLoad = new Object();
- this.permDeniedCount = new Object();
- this.windowPollers = new Array();
- // DGF for backwards compatibility
- this.browserbot = this;
-
- var self = this;
-
- objectExtend(this, PageBot.prototype);
- this._registerAllLocatorFunctions();
-
- this.recordPageLoad = function(elementOrWindow) {
- LOG.debug("Page load detected");
- try {
- if (elementOrWindow.location && elementOrWindow.location.href) {
- LOG.debug("Page load location=" + elementOrWindow.location.href);
- } else if (elementOrWindow.contentWindow && elementOrWindow.contentWindow.location && elementOrWindow.contentWindow.location.href) {
- LOG.debug("Page load location=" + elementOrWindow.contentWindow.location.href);
- } else {
- LOG.debug("Page load location unknown, current window location=" + this.getCurrentWindow(true).location);
- }
- } catch (e) {
- LOG.error("Caught an exception attempting to log location; this should get noticed soon!");
- LOG.exception(e);
- self.pageLoadError = e;
- return;
- }
- self.newPageLoaded = true;
- };
-
- this.isNewPageLoaded = function() {
- if (this.pageLoadError) {
- LOG.error("isNewPageLoaded found an old pageLoadError");
- var e = this.pageLoadError;
- this.pageLoadError = null;
- throw e;
- }
- return self.newPageLoaded;
- };
-
-};
-
-// DGF PageBot exists for backwards compatibility with old user-extensions
-var PageBot = function(){};
-
-BrowserBot.createForWindow = function(window, proxyInjectionMode) {
- var browserbot;
- LOG.debug('createForWindow');
- LOG.debug("browserName: " + browserVersion.name);
- LOG.debug("userAgent: " + navigator.userAgent);
- if (browserVersion.isIE) {
- browserbot = new IEBrowserBot(window);
- }
- else if (browserVersion.isKonqueror) {
- browserbot = new KonquerorBrowserBot(window);
- }
- else if (browserVersion.isOpera) {
- browserbot = new OperaBrowserBot(window);
- }
- else if (browserVersion.isSafari) {
- browserbot = new SafariBrowserBot(window);
- }
- else {
- // Use mozilla by default
- browserbot = new MozillaBrowserBot(window);
- }
- // getCurrentWindow has the side effect of modifying it to handle page loads etc
- browserbot.proxyInjectionMode = proxyInjectionMode;
- browserbot.getCurrentWindow(); // for modifyWindow side effect. This is not a transparent style
- return browserbot;
-};
-
-// todo: rename? This doesn't actually "do" anything.
-BrowserBot.prototype.doModalDialogTest = function(test) {
- this.modalDialogTest = test;
-};
-
-BrowserBot.prototype.cancelNextConfirmation = function(result) {
- this.nextConfirmResult = result;
-};
-
-BrowserBot.prototype.setNextPromptResult = function(result) {
- this.nextPromptResult = result;
-};
-
-BrowserBot.prototype.hasAlerts = function() {
- return (this.recordedAlerts.length > 0);
-};
-
-BrowserBot.prototype.relayBotToRC = function(s) {
- // DGF need to do this funny trick to see if we're in PI mode, because
- // "this" might be the window, rather than the browserbot (e.g. during window.alert)
- var piMode = this.proxyInjectionMode;
- if (!piMode) {
- if (typeof(selenium) != "undefined") {
- piMode = selenium.browserbot && selenium.browserbot.proxyInjectionMode;
- }
- }
- if (piMode) {
- this.relayToRC("selenium." + s);
- }
-};
-
-BrowserBot.prototype.relayToRC = function(name) {
- var object = eval(name);
- var s = 'state:' + serializeObject(name, object) + "\n";
- sendToRC(s,"state=true");
-}
-
-BrowserBot.prototype.resetPopups = function() {
- this.recordedAlerts = [];
- this.recordedConfirmations = [];
- this.recordedPrompts = [];
-}
-
-BrowserBot.prototype.getNextAlert = function() {
- var t = this.recordedAlerts.shift();
- if (t) {
- t = t.replace(/\n/g, " "); // because Selenese loses \n's when retrieving text from HTML table
- }
- this.relayBotToRC("browserbot.recordedAlerts");
- return t;
-};
-
-BrowserBot.prototype.hasConfirmations = function() {
- return (this.recordedConfirmations.length > 0);
-};
-
-BrowserBot.prototype.getNextConfirmation = function() {
- var t = this.recordedConfirmations.shift();
- this.relayBotToRC("browserbot.recordedConfirmations");
- return t;
-};
-
-BrowserBot.prototype.hasPrompts = function() {
- return (this.recordedPrompts.length > 0);
-};
-
-BrowserBot.prototype.getNextPrompt = function() {
- var t = this.recordedPrompts.shift();
- this.relayBotToRC("browserbot.recordedPrompts");
- return t;
-};
-
-/* Fire a mouse event in a browser-compatible manner */
-
-BrowserBot.prototype.triggerMouseEvent = function(element, eventType, canBubble, clientX, clientY, button) {
- clientX = clientX ? clientX : 0;
- clientY = clientY ? clientY : 0;
-
- LOG.debug("triggerMouseEvent assumes setting screenX and screenY to 0 is ok");
- var screenX = 0;
- var screenY = 0;
-
- canBubble = (typeof(canBubble) == undefined) ? true : canBubble;
- if (element.fireEvent && element.ownerDocument && element.ownerDocument.createEventObject) { //IE
- var evt = createEventObject(element, this.controlKeyDown, this.altKeyDown, this.shiftKeyDown, this.metaKeyDown);
- evt.detail = 0;
- evt.button = button ? button : 1; // default will be the left mouse click ( http://www.javascriptkit.com/jsref/event.shtml )
- evt.relatedTarget = null;
- if (!screenX && !screenY && !clientX && !clientY && !this.controlKeyDown && !this.altKeyDown && !this.shiftKeyDown && !this.metaKeyDown) {
- element.fireEvent('on' + eventType);
- }
- else {
- evt.screenX = screenX;
- evt.screenY = screenY;
- evt.clientX = clientX;
- evt.clientY = clientY;
-
- // when we go this route, window.event is never set to contain the event we have just created.
- // ideally we could just slide it in as follows in the try-block below, but this normally
- // doesn't work. This is why I try to avoid this code path, which is only required if we need to
- // set attributes on the event (e.g., clientX).
- try {
- window.event = evt;
- }
- catch(e) {
- // getting an "Object does not support this action or property" error. Save the event away
- // for future reference.
- // TODO: is there a way to update window.event?
-
- // work around for http://jira.openqa.org/browse/SEL-280 -- make the event available somewhere:
- selenium.browserbot.getCurrentWindow().selenium_event = evt;
- }
- element.fireEvent('on' + eventType, evt);
- }
- }
- else {
- var evt = document.createEvent('MouseEvents');
- if (evt.initMouseEvent)
- {
- // see http://developer.mozilla.org/en/docs/DOM:event.button and
- // http://developer.mozilla.org/en/docs/DOM:event.initMouseEvent for button ternary logic logic
- //Safari
- evt.initMouseEvent(eventType, canBubble, true, document.defaultView, 1, screenX, screenY, clientX, clientY,
- this.controlKeyDown, this.altKeyDown, this.shiftKeyDown, this.metaKeyDown, button ? button : 0, null);
- }
- else {
- LOG.warn("element doesn't have initMouseEvent; firing an event which should -- but doesn't -- have other mouse-event related attributes here, as well as controlKeyDown, altKeyDown, shiftKeyDown, metaKeyDown");
- evt.initEvent(eventType, canBubble, true);
-
- evt.shiftKey = this.shiftKeyDown;
- evt.metaKey = this.metaKeyDown;
- evt.altKey = this.altKeyDown;
- evt.ctrlKey = this.controlKeyDown;
- if(button)
- {
- evt.button = button;
- }
- }
- element.dispatchEvent(evt);
- }
-}
-
-BrowserBot.prototype._windowClosed = function(win) {
- var c = win.closed;
- if (c == null) return true;
- return c;
-};
-
-BrowserBot.prototype._modifyWindow = function(win) {
- // In proxyInjectionMode, have to suppress LOG calls in _modifyWindow to avoid an infinite loop
- if (this._windowClosed(win)) {
- if (!this.proxyInjectionMode) {
- LOG.error("modifyWindow: Window was closed!");
- }
- return null;
- }
- if (!this.proxyInjectionMode) {
- LOG.debug('modifyWindow ' + this.uniqueId + ":" + win[this.uniqueId]);
- }
- if (!win[this.uniqueId]) {
- win[this.uniqueId] = 1;
- this.modifyWindowToRecordPopUpDialogs(win, this);
- }
- // In proxyInjection mode, we have our own mechanism for detecting page loads
- if (!this.proxyInjectionMode) {
- this.modifySeparateTestWindowToDetectPageLoads(win);
- }
- if (win.frames && win.frames.length && win.frames.length > 0) {
- for (var i = 0; i < win.frames.length; i++) {
- try {
- this._modifyWindow(win.frames[i]);
- } catch (e) {} // we're just trying to be opportunistic; don't worry if this doesn't work out
- }
- }
- return win;
-};
-
-BrowserBot.prototype.selectWindow = function(target) {
- if (!target || target == "null") {
- this._selectTopWindow();
- return;
- }
- var result = target.match(/^([a-zA-Z]+)=(.*)/);
- if (!result) {
- try {
- this._selectWindowByName(target);
- }
- catch (e) {
- this._selectWindowByTitle(target);
- }
- return;
- }
- locatorType = result[1];
- locatorValue = result[2];
- if (locatorType == "title") {
- this._selectWindowByTitle(locatorValue);
- }
- // TODO separate name and var into separate functions
- else if (locatorType == "name") {
- this._selectWindowByName(locatorValue);
- } else if (locatorType == "var") {
- this._selectWindowByName(locatorValue);
- } else {
- throw new SeleniumError("Window locator not recognized: " + locatorType);
- }
-};
-
-BrowserBot.prototype._selectTopWindow = function() {
- this.currentWindowName = null;
- this.currentWindow = this.topWindow;
- this.topFrame = this.topWindow;
- this.isSubFrameSelected = false;
-}
-
-BrowserBot.prototype._selectWindowByName = function(target) {
- this.currentWindow = this.getWindowByName(target, false);
- this.topFrame = this.currentWindow;
- this.currentWindowName = target;
- this.isSubFrameSelected = false;
-}
-
-BrowserBot.prototype._selectWindowByTitle = function(target) {
- var windowName = this.getWindowNameByTitle(target);
- if (!windowName) {
- this._selectTopWindow();
- } else {
- this._selectWindowByName(windowName);
- }
-}
-
-BrowserBot.prototype.selectFrame = function(target) {
- if (target.indexOf("index=") == 0) {
- target = target.substr(6);
- var frame = this.getCurrentWindow().frames[target];
- if (frame == null) {
- throw new SeleniumError("Not found: frames["+index+"]");
- }
- if (!frame.document) {
- throw new SeleniumError("frames["+index+"] is not a frame");
- }
- this.currentWindow = frame;
- this.isSubFrameSelected = true;
- }
- else if (target == "relative=up" || target == "relative=parent") {
- this.currentWindow = this.getCurrentWindow().parent;
- this.isSubFrameSelected = (this._getFrameElement(this.currentWindow) != null);
- } else if (target == "relative=top") {
- this.currentWindow = this.topFrame;
- this.isSubFrameSelected = false;
- } else {
- var frame = this.findElement(target);
- if (frame == null) {
- throw new SeleniumError("Not found: " + target);
- }
- // now, did they give us a frame or a frame ELEMENT?
- var match = false;
- if (frame.contentWindow) {
- // this must be a frame element
- if (browserVersion.isHTA) {
- // stupid HTA bug; can't get in the front door
- target = frame.contentWindow.name;
- } else {
- this.currentWindow = frame.contentWindow;
- this.isSubFrameSelected = true;
- match = true;
- }
- } else if (frame.document && frame.location) {
- // must be an actual window frame
- this.currentWindow = frame;
- this.isSubFrameSelected = true;
- match = true;
- }
-
- if (!match) {
- // neither, let's loop through the frame names
- var win = this.getCurrentWindow();
-
- if (win && win.frames && win.frames.length) {
- for (var i = 0; i < win.frames.length; i++) {
- if (win.frames[i].name == target) {
- this.currentWindow = win.frames[i];
- this.isSubFrameSelected = true;
- match = true;
- break;
- }
- }
- }
- if (!match) {
- throw new SeleniumError("Not a frame: " + target);
- }
- }
- }
- // modifies the window
- this.getCurrentWindow();
-};
-
-BrowserBot.prototype.doesThisFrameMatchFrameExpression = function(currentFrameString, target) {
- var isDom = false;
- if (target.indexOf("dom=") == 0) {
- target = target.substr(4);
- isDom = true;
- } else if (target.indexOf("index=") == 0) {
- target = "frames[" + target.substr(6) + "]";
- isDom = true;
- }
- var t;
- try {
- eval("t=" + currentFrameString + "." + target);
- } catch (e) {
- }
- var autWindow = this.browserbot.getCurrentWindow();
- if (t != null) {
- try {
- if (t.window == autWindow) {
- return true;
- }
- if (t.window.uniqueId == autWindow.uniqueId) {
- return true;
- }
- return false;
- } catch (permDenied) {
- // DGF if the windows are incomparable, they're probably not the same...
- }
- }
- if (isDom) {
- return false;
- }
- var currentFrame;
- eval("currentFrame=" + currentFrameString);
- if (target == "relative=up") {
- if (currentFrame.window.parent == autWindow) {
- return true;
- }
- return false;
- }
- if (target == "relative=top") {
- if (currentFrame.window.top == autWindow) {
- return true;
- }
- return false;
- }
- if (currentFrame.window == autWindow.parent) {
- if (autWindow.name == target) {
- return true;
- }
- try {
- var element = this.findElement(target, currentFrame.window);
- if (element.contentWindow == autWindow) {
- return true;
- }
- } catch (e) {}
- }
- return false;
-};
-
-BrowserBot.prototype.openLocation = function(target) {
- // We're moving to a new page - clear the current one
- var win = this.getCurrentWindow();
- LOG.debug("openLocation newPageLoaded = false");
- this.newPageLoaded = false;
-
- this.setOpenLocation(win, target);
-};
-
-BrowserBot.prototype.openWindow = function(url, windowID) {
- if (url != "") {
- url = absolutify(url, this.baseUrl);
- }
- if (browserVersion.isHTA) {
- // in HTA mode, calling .open on the window interprets the url relative to that window
- // we need to absolute-ize the URL to make it consistent
- var child = this.getCurrentWindow().open(url, windowID);
- selenium.browserbot.openedWindows[windowID] = child;
- } else {
- this.getCurrentWindow().open(url, windowID);
- }
-};
-
-BrowserBot.prototype.setIFrameLocation = function(iframe, location) {
- iframe.src = location;
-};
-
-BrowserBot.prototype.setOpenLocation = function(win, loc) {
- loc = absolutify(loc, this.baseUrl);
- if (browserVersion.isHTA) {
- var oldHref = win.location.href;
- win.location.href = loc;
- var marker = null;
- try {
- marker = this.isPollingForLoad(win);
- if (marker && win.location[marker]) {
- win.location[marker] = false;
- }
- } catch (e) {} // DGF don't know why, but this often fails
- } else {
- win.location.href = loc;
- }
-};
-
-BrowserBot.prototype.getCurrentPage = function() {
- return this;
-};
-
-BrowserBot.prototype.modifyWindowToRecordPopUpDialogs = function(windowToModify, browserBot) {
- var self = this;
-
- windowToModify.seleniumAlert = windowToModify.alert;
-
- windowToModify.alert = function(alert) {
- browserBot.recordedAlerts.push(alert);
- self.relayBotToRC.call(self, "browserbot.recordedAlerts");
- };
-
- windowToModify.confirm = function(message) {
- browserBot.recordedConfirmations.push(message);
- var result = browserBot.nextConfirmResult;
- browserBot.nextConfirmResult = true;
- self.relayBotToRC.call(self, "browserbot.recordedConfirmations");
- return result;
- };
-
- windowToModify.prompt = function(message) {
- browserBot.recordedPrompts.push(message);
- var result = !browserBot.nextConfirmResult ? null : browserBot.nextPromptResult;
- browserBot.nextConfirmResult = true;
- browserBot.nextPromptResult = '';
- self.relayBotToRC.call(self, "browserbot.recordedPrompts");
- return result;
- };
-
- // Keep a reference to all popup windows by name
- // note that in IE the "windowName" argument must be a valid javascript identifier, it seems.
- var originalOpen = windowToModify.open;
- var originalOpenReference;
- if (browserVersion.isHTA) {
- originalOpenReference = 'selenium_originalOpen' + new Date().getTime();
- windowToModify[originalOpenReference] = windowToModify.open;
- }
-
- var isHTA = browserVersion.isHTA;
-
- var newOpen = function(url, windowName, windowFeatures, replaceFlag) {
- var myOriginalOpen = originalOpen;
- if (isHTA) {
- myOriginalOpen = this[originalOpenReference];
- }
- if (windowName == "" || windowName == "_blank") {
- windowName = "selenium_blank" + Math.round(100000 * Math.random());
- LOG.warn("Opening window '_blank', which is not a real window name. Randomizing target to be: " + windowName);
- }
- var openedWindow = myOriginalOpen(url, windowName, windowFeatures, replaceFlag);
- LOG.debug("window.open call intercepted; window ID (which you can use with selectWindow()) is \"" + windowName + "\"");
- if (windowName!=null) {
- openedWindow["seleniumWindowName"] = windowName;
- }
- selenium.browserbot.openedWindows[windowName] = openedWindow;
- return openedWindow;
- };
-
- if (browserVersion.isHTA) {
- originalOpenReference = 'selenium_originalOpen' + new Date().getTime();
- newOpenReference = 'selenium_newOpen' + new Date().getTime();
- var setOriginalRef = "this['" + originalOpenReference + "'] = this.open;";
-
- if (windowToModify.eval) {
- windowToModify.eval(setOriginalRef);
- windowToModify.open = newOpen;
- } else {
- // DGF why can't I eval here? Seems like I'm querying the window at a bad time, maybe?
- setOriginalRef += "this.open = this['" + newOpenReference + "'];";
- windowToModify[newOpenReference] = newOpen;
- windowToModify.setTimeout(setOriginalRef, 0);
- }
- } else {
- windowToModify.open = newOpen;
- }
-};
-
-/**
- * Call the supplied function when a the current page unloads and a new one loads.
- * This is done by polling continuously until the document changes and is fully loaded.
- */
-BrowserBot.prototype.modifySeparateTestWindowToDetectPageLoads = function(windowObject) {
- // Since the unload event doesn't fire in Safari 1.3, we start polling immediately
- if (!windowObject) {
- LOG.warn("modifySeparateTestWindowToDetectPageLoads: no windowObject!");
- return;
- }
- if (this._windowClosed(windowObject)) {
- LOG.info("modifySeparateTestWindowToDetectPageLoads: windowObject was closed");
- return;
- }
- var oldMarker = this.isPollingForLoad(windowObject);
- if (oldMarker) {
- LOG.debug("modifySeparateTestWindowToDetectPageLoads: already polling this window: " + oldMarker);
- return;
- }
-
- var marker = 'selenium' + new Date().getTime();
- LOG.debug("Starting pollForLoad (" + marker + "): " + windowObject.location);
- this.pollingForLoad[marker] = true;
- // if this is a frame, add a load listener, otherwise, attach a poller
- var frameElement = this._getFrameElement(windowObject);
- // DGF HTA mode can't attach load listeners to subframes (yuk!)
- var htaSubFrame = this._isHTASubFrame(windowObject);
- if (frameElement && !htaSubFrame) {
- LOG.debug("modifySeparateTestWindowToDetectPageLoads: this window is a frame; attaching a load listener");
- addLoadListener(frameElement, this.recordPageLoad);
- frameElement[marker] = true;
- frameElement["frame"+this.uniqueId] = marker;
- LOG.debug("dgf this.uniqueId="+this.uniqueId);
- LOG.debug("dgf marker="+marker);
- LOG.debug("dgf frameElement['frame'+this.uniqueId]="+frameElement['frame'+this.uniqueId]);
-frameElement[this.uniqueId] = marker;
-LOG.debug("dgf frameElement[this.uniqueId]="+frameElement[this.uniqueId]);
- } else {
- windowObject.location[marker] = true;
- windowObject[this.uniqueId] = marker;
- this.pollForLoad(this.recordPageLoad, windowObject, windowObject.document, windowObject.location, windowObject.location.href, marker);
- }
-};
-
-BrowserBot.prototype._isHTASubFrame = function(win) {
- if (!browserVersion.isHTA) return false;
- // DGF this is wrong! what if "win" isn't the selected window?
- return this.isSubFrameSelected;
-}
-
-BrowserBot.prototype._getFrameElement = function(win) {
- var frameElement = null;
- var caught;
- try {
- frameElement = win.frameElement;
- } catch (e) {
- caught = true;
- }
- if (caught) {
- // on IE, checking frameElement in a pop-up results in a "No such interface supported" exception
- // but it might have a frame element anyway!
- var parentContainsIdenticallyNamedFrame = false;
- try {
- parentContainsIdenticallyNamedFrame = win.parent.frames[win.name];
- } catch (e) {} // this may fail if access is denied to the parent; in that case, assume it's not a pop-up
-
- if (parentContainsIdenticallyNamedFrame) {
- // it can't be a coincidence that the parent has a frame with the same name as myself!
- var result;
- try {
- result = parentContainsIdenticallyNamedFrame.frameElement;
- if (result) {
- return result;
- }
- } catch (e) {} // it was worth a try! _getFrameElementsByName is often slow
- result = this._getFrameElementByName(win.name, win.parent.document, win);
- return result;
- }
- }
- LOG.debug("_getFrameElement: frameElement="+frameElement);
- if (frameElement) {
- LOG.debug("frameElement.name="+frameElement.name);
- }
- return frameElement;
-}
-
-BrowserBot.prototype._getFrameElementByName = function(name, doc, win) {
- var frames;
- var frame;
- var i;
- frames = doc.getElementsByTagName("iframe");
- for (i = 0; i < frames.length; i++) {
- frame = frames[i];
- if (frame.name === name) {
- return frame;
- }
- }
- frames = doc.getElementsByTagName("frame");
- for (i = 0; i < frames.length; i++) {
- frame = frames[i];
- if (frame.name === name) {
- return frame;
- }
- }
- // DGF weird; we only call this function when we know the doc contains the frame
- LOG.warn("_getFrameElementByName couldn't find a frame or iframe; checking every element for the name " + name);
- return BrowserBot.prototype.locateElementByName(win.name, win.parent.document);
-}
-
-
-/**
- * Set up a polling timer that will keep checking the readyState of the document until it's complete.
- * Since we might call this before the original page is unloaded, we first check to see that the current location
- * or href is different from the original one.
- */
-BrowserBot.prototype.pollForLoad = function(loadFunction, windowObject, originalDocument, originalLocation, originalHref, marker) {
- LOG.debug("pollForLoad original (" + marker + "): " + originalHref);
- try {
- if (this._windowClosed(windowObject)) {
- LOG.debug("pollForLoad WINDOW CLOSED (" + marker + ")");
- delete this.pollingForLoad[marker];
- return;
- }
-
- var isSamePage = this._isSamePage(windowObject, originalDocument, originalLocation, originalHref, marker);
- var rs = this.getReadyState(windowObject, windowObject.document);
-
- if (!isSamePage && rs == 'complete') {
- var currentHref = windowObject.location.href;
- LOG.debug("pollForLoad FINISHED (" + marker + "): " + rs + " (" + currentHref + ")");
- delete this.pollingForLoad[marker];
- this._modifyWindow(windowObject);
- var newMarker = this.isPollingForLoad(windowObject);
- if (!newMarker) {
- LOG.debug("modifyWindow didn't start new poller: " + newMarker);
- this.modifySeparateTestWindowToDetectPageLoads(windowObject);
- }
- newMarker = this.isPollingForLoad(windowObject);
- var currentlySelectedWindow;
- var currentlySelectedWindowMarker;
- currentlySelectedWindow =this.getCurrentWindow(true);
- currentlySelectedWindowMarker = currentlySelectedWindow[this.uniqueId];
-
- LOG.debug("pollForLoad (" + marker + ") restarting " + newMarker);
- if (/(TestRunner-splash|Blank)\.html\?start=true$/.test(currentHref)) {
- LOG.debug("pollForLoad Oh, it's just the starting page. Never mind!");
- } else if (currentlySelectedWindowMarker == newMarker) {
- loadFunction(currentlySelectedWindow);
- } else {
- LOG.debug("pollForLoad page load detected in non-current window; ignoring (currentlySelected="+currentlySelectedWindowMarker+", detection in "+newMarker+")");
- }
- return;
- }
- LOG.debug("pollForLoad continue (" + marker + "): " + currentHref);
- this.reschedulePoller(loadFunction, windowObject, originalDocument, originalLocation, originalHref, marker);
- } catch (e) {
- LOG.debug("Exception during pollForLoad; this should get noticed soon (" + e.message + ")!");
- //DGF this is supposed to get logged later; log it at debug just in case
- //LOG.exception(e);
- this.pageLoadError = e;
- }
-};
-
-BrowserBot.prototype._isSamePage = function(windowObject, originalDocument, originalLocation, originalHref, marker) {
- var currentDocument = windowObject.document;
- var currentLocation = windowObject.location;
- var currentHref = currentLocation.href
-
- var sameDoc = this._isSameDocument(originalDocument, currentDocument);
-
- var sameLoc = (originalLocation === currentLocation);
-
- // hash marks don't meant the page has loaded, so we need to strip them off if they exist...
- var currentHash = currentHref.indexOf('#');
- if (currentHash > 0) {
- currentHref = currentHref.substring(0, currentHash);
- }
- var originalHash = originalHref.indexOf('#');
- if (originalHash > 0) {
- originalHref = originalHref.substring(0, originalHash);
- }
- LOG.debug("_isSamePage: currentHref: " + currentHref);
- LOG.debug("_isSamePage: originalHref: " + originalHref);
-
- var sameHref = (originalHref === currentHref);
- var markedLoc = currentLocation[marker];
-
- if (browserVersion.isKonqueror || browserVersion.isSafari) {
- // the mark disappears too early on these browsers
- markedLoc = true;
- }
-
- // since this is some _very_ important logic, especially for PI and multiWindow mode, we should log all these out
- LOG.debug("_isSamePage: sameDoc: " + sameDoc);
- LOG.debug("_isSamePage: sameLoc: " + sameLoc);
- LOG.debug("_isSamePage: sameHref: " + sameHref);
- LOG.debug("_isSamePage: markedLoc: " + markedLoc);
-
- return sameDoc && sameLoc && sameHref && markedLoc
-};
-
-BrowserBot.prototype._isSameDocument = function(originalDocument, currentDocument) {
- return originalDocument === currentDocument;
-};
-
-
-BrowserBot.prototype.getReadyState = function(windowObject, currentDocument) {
- var rs = currentDocument.readyState;
- if (rs == null) {
- if ((this.buttonWindow!=null && this.buttonWindow.document.readyState == null) // not proxy injection mode (and therefore buttonWindow isn't null)
- || (top.document.readyState == null)) { // proxy injection mode (and therefore everything's in the top window, but buttonWindow doesn't exist)
- // uh oh! we're probably on Firefox with no readyState extension installed!
- // We'll have to just take a guess as to when the document is loaded; this guess
- // will never be perfect. :-(
- if (typeof currentDocument.getElementsByTagName != 'undefined'
- && typeof currentDocument.getElementById != 'undefined'
- && ( currentDocument.getElementsByTagName('body')[0] != null
- || currentDocument.body != null )) {
- if (windowObject.frameElement && windowObject.location.href == "about:blank" && windowObject.frameElement.src != "about:blank") {
- LOG.info("getReadyState not loaded, frame location was about:blank, but frame src = " + windowObject.frameElement.src);
- return null;
- }
- LOG.debug("getReadyState = windowObject.frames.length = " + windowObject.frames.length);
- for (var i = 0; i < windowObject.frames.length; i++) {
- LOG.debug("i = " + i);
- if (this.getReadyState(windowObject.frames[i], windowObject.frames[i].document) != 'complete') {
- LOG.debug("getReadyState aha! the nested frame " + windowObject.frames[i].name + " wasn't ready!");
- return null;
- }
- }
-
- rs = 'complete';
- } else {
- LOG.debug("pollForLoad readyState was null and DOM appeared to not be ready yet");
- }
- }
- }
- else if (rs == "loading" && browserVersion.isIE) {
- LOG.debug("pageUnloading = true!!!!");
- this.pageUnloading = true;
- }
- LOG.debug("getReadyState returning " + rs);
- return rs;
-};
-
-/** This function isn't used normally, but was the way we used to schedule pollers:
- asynchronously executed autonomous units. This is deprecated, but remains here
- for future reference.
- */
-BrowserBot.prototype.XXXreschedulePoller = function(loadFunction, windowObject, originalDocument, originalLocation, originalHref, marker) {
- var self = this;
- window.setTimeout(function() {
- self.pollForLoad(loadFunction, windowObject, originalDocument, originalLocation, originalHref, marker);
- }, 500);
-};
-
-/** This function isn't used normally, but is useful for debugging asynchronous pollers
- * To enable it, rename it to "reschedulePoller", so it will override the
- * existing reschedulePoller function
- */
-BrowserBot.prototype.XXXreschedulePoller = function(loadFunction, windowObject, originalDocument, originalLocation, originalHref, marker) {
- var doc = this.buttonWindow.document;
- var button = doc.createElement("button");
- var buttonName = doc.createTextNode(marker + " - " + windowObject.name);
- button.appendChild(buttonName);
- var tools = doc.getElementById("tools");
- var self = this;
- button.onclick = function() {
- tools.removeChild(button);
- self.pollForLoad(loadFunction, windowObject, originalDocument, originalLocation, originalHref, marker);
- };
- tools.appendChild(button);
- window.setTimeout(button.onclick, 500);
-};
-
-BrowserBot.prototype.reschedulePoller = function(loadFunction, windowObject, originalDocument, originalLocation, originalHref, marker) {
- var self = this;
- var pollerFunction = function() {
- self.pollForLoad(loadFunction, windowObject, originalDocument, originalLocation, originalHref, marker);
- };
- this.windowPollers.push(pollerFunction);
-};
-
-BrowserBot.prototype.runScheduledPollers = function() {
- LOG.debug("runScheduledPollers");
- var oldPollers = this.windowPollers;
- this.windowPollers = new Array();
- for (var i = 0; i < oldPollers.length; i++) {
- oldPollers[i].call();
- }
- LOG.debug("runScheduledPollers DONE");
-};
-
-BrowserBot.prototype.isPollingForLoad = function(win) {
- var marker;
- var frameElement = this._getFrameElement(win);
- var htaSubFrame = this._isHTASubFrame(win);
- if (frameElement && !htaSubFrame) {
- marker = frameElement["frame"+this.uniqueId];
- } else {
- marker = win[this.uniqueId];
- }
- if (!marker) {
- LOG.debug("isPollingForLoad false, missing uniqueId " + this.uniqueId + ": " + marker);
- return false;
- }
- if (!this.pollingForLoad[marker]) {
- LOG.debug("isPollingForLoad false, this.pollingForLoad[" + marker + "]: " + this.pollingForLoad[marker]);
- return false;
- }
- return marker;
-};
-
-BrowserBot.prototype.getWindowByName = function(windowName, doNotModify) {
- LOG.debug("getWindowByName(" + windowName + ")");
- // First look in the map of opened windows
- var targetWindow = this.openedWindows[windowName];
- if (!targetWindow) {
- targetWindow = this.topWindow[windowName];
- }
- if (!targetWindow && windowName == "_blank") {
- for (var winName in this.openedWindows) {
- // _blank can match selenium_blank*, if it looks like it's OK (valid href, not closed)
- if (/^selenium_blank/.test(winName)) {
- targetWindow = this.openedWindows[winName];
- var ok;
- try {
- if (!this._windowClosed(targetWindow)) {
- ok = targetWindow.location.href;
- }
- } catch (e) {}
- if (ok) break;
- }
- }
- }
- if (!targetWindow) {
- throw new SeleniumError("Window does not exist. If this looks like a Selenium bug, make sure to read http://selenium-core.openqa.org/reference.html#openWindow for potential workarounds.");
- }
- if (browserVersion.isHTA) {
- try {
- targetWindow.location.href;
- } catch (e) {
- targetWindow = window.open("", targetWindow.name);
- this.openedWindows[targetWindow.name] = targetWindow;
- }
- }
- if (!doNotModify) {
- this._modifyWindow(targetWindow);
- }
- return targetWindow;
-};
-
-/**
- * Find a window name from the window title.
- */
-BrowserBot.prototype.getWindowNameByTitle = function(windowTitle) {
- LOG.debug("getWindowNameByTitle(" + windowTitle + ")");
-
- // First look in the map of opened windows and iterate them
- for (var windowName in this.openedWindows) {
- var targetWindow = this.openedWindows[windowName];
-
- // If the target window's title is our title
- try {
- // TODO implement Pattern Matching here
- if (!this._windowClosed(targetWindow) &&
- targetWindow.document.title == windowTitle) {
- return windowName;
- }
- } catch (e) {
- // You'll often get Permission Denied errors here in IE
- // eh, if we can't read this window's title,
- // it's probably not available to us right now anyway
- }
- }
-
- try {
- if (this.topWindow.document.title == windowTitle) {
- return "";
- }
- } catch (e) {} // IE Perm denied
-
- throw new SeleniumError("Could not find window with title " + windowTitle);
-};
-
-BrowserBot.prototype.getCurrentWindow = function(doNotModify) {
- if (this.proxyInjectionMode) {
- return window;
- }
- var testWindow = this.currentWindow;
- if (!doNotModify) {
- this._modifyWindow(testWindow);
- LOG.debug("getCurrentWindow newPageLoaded = false");
- this.newPageLoaded = false;
- }
- testWindow = this._handleClosedSubFrame(testWindow, doNotModify);
- return testWindow;
-};
-
-/**
- * Offer a method the end-user can reliably use to retrieve the current window.
- * This should work even for windows with an XPCNativeWrapper. Returns the
- * current window object.
- */
-BrowserBot.prototype.getUserWindow = function() {
- var userWindow = this.getCurrentWindow(true);
-
- if (userWindow.wrappedJSObject) {
- userWindow = userWindow.wrappedJSObject;
- }
-
- return userWindow;
-};
-
-BrowserBot.prototype._handleClosedSubFrame = function(testWindow, doNotModify) {
- if (this.proxyInjectionMode) {
- return testWindow;
- }
-
- if (this.isSubFrameSelected) {
- var missing = true;
- if (testWindow.parent && testWindow.parent.frames && testWindow.parent.frames.length) {
- for (var i = 0; i < testWindow.parent.frames.length; i++) {
- if (testWindow.parent.frames[i] == testWindow) {
- missing = false;
- break;
- }
- }
- }
- if (missing) {
- LOG.warn("Current subframe appears to have closed; selecting top frame");
- this.selectFrame("relative=top");
- return this.getCurrentWindow(doNotModify);
- }
- } else if (this._windowClosed(testWindow)) {
- var closedError = new SeleniumError("Current window or frame is closed!");
- closedError.windowClosed = true;
- throw closedError;
- }
- return testWindow;
-};
-
-BrowserBot.prototype.highlight = function (element, force) {
- if (force || this.shouldHighlightLocatedElement) {
- try {
- highlight(element);
- } catch (e) {} // DGF element highlighting is low-priority and possibly dangerous
- }
- return element;
-}
-
-BrowserBot.prototype.setShouldHighlightElement = function (shouldHighlight) {
- this.shouldHighlightLocatedElement = shouldHighlight;
-}
-
-/*****************************************************************/
-/* BROWSER-SPECIFIC FUNCTIONS ONLY AFTER THIS LINE */
-
-
-BrowserBot.prototype._registerAllLocatorFunctions = function() {
- // TODO - don't do this in the constructor - only needed once ever
- this.locationStrategies = {};
- for (var functionName in this) {
- var result = /^locateElementBy([A-Z].+)$/.exec(functionName);
- if (result != null) {
- var locatorFunction = this[functionName];
- if (typeof(locatorFunction) != 'function') {
- continue;
- }
- // Use a specified prefix in preference to one generated from
- // the function name
- var locatorPrefix = locatorFunction.prefix || result[1].toLowerCase();
- this.locationStrategies[locatorPrefix] = locatorFunction;
- }
- }
-
- /**
- * Find a locator based on a prefix.
- */
- this.findElementBy = function(locatorType, locator, inDocument, inWindow) {
- var locatorFunction = this.locationStrategies[locatorType];
- if (! locatorFunction) {
- throw new SeleniumError("Unrecognised locator type: '" + locatorType + "'");
- }
- return locatorFunction.call(this, locator, inDocument, inWindow);
- };
-
- /**
- * The implicit locator, that is used when no prefix is supplied.
- */
- this.locationStrategies['implicit'] = function(locator, inDocument, inWindow) {
- if (locator.startsWith('//')) {
- return this.locateElementByXPath(locator, inDocument, inWindow);
- }
- if (locator.startsWith('document.')) {
- return this.locateElementByDomTraversal(locator, inDocument, inWindow);
- }
- return this.locateElementByIdentifier(locator, inDocument, inWindow);
- };
-}
-
-BrowserBot.prototype.getDocument = function() {
- return this.getCurrentWindow().document;
-}
-
-BrowserBot.prototype.getTitle = function() {
- var t = this.getDocument().title;
- if (typeof(t) == "string") {
- t = t.trim();
- }
- return t;
-}
-
-BrowserBot.prototype.getCookieByName = function(cookieName, doc) {
- if (!doc) doc = this.getDocument();
- var ck = doc.cookie;
- if (!ck) return null;
- var ckPairs = ck.split(/;/);
- for (var i = 0; i < ckPairs.length; i++) {
- var ckPair = ckPairs[i].trim();
- var ckNameValue = ckPair.split(/=/);
- var ckName = decodeURIComponent(ckNameValue[0]);
- if (ckName === cookieName) {
- return decodeURIComponent(ckNameValue[1]);
- }
- }
- return null;
-}
-
-BrowserBot.prototype.getAllCookieNames = function(doc) {
- if (!doc) doc = this.getDocument();
- var ck = doc.cookie;
- if (!ck) return [];
- var cookieNames = [];
- var ckPairs = ck.split(/;/);
- for (var i = 0; i < ckPairs.length; i++) {
- var ckPair = ckPairs[i].trim();
- var ckNameValue = ckPair.split(/=/);
- var ckName = decodeURIComponent(ckNameValue[0]);
- cookieNames.push(ckName);
- }
- return cookieNames;
-}
-
-BrowserBot.prototype.deleteCookie = function(cookieName, domain, path, doc) {
- if (!doc) doc = this.getDocument();
- var expireDateInMilliseconds = (new Date()).getTime() + (-1 * 1000);
- var cookie = cookieName + "=deleted; ";
- if (path) {
- cookie += "path=" + path + "; ";
- }
- if (domain) {
- cookie += "domain=" + domain + "; ";
- }
- cookie += "expires=" + new Date(expireDateInMilliseconds).toGMTString();
- LOG.debug("Setting cookie to: " + cookie);
- doc.cookie = cookie;
-}
-
-/** Try to delete cookie, return false if it didn't work */
-BrowserBot.prototype._maybeDeleteCookie = function(cookieName, domain, path, doc) {
- this.deleteCookie(cookieName, domain, path, doc);
- return (!this.getCookieByName(cookieName, doc));
-}
-
-
-BrowserBot.prototype._recursivelyDeleteCookieDomains = function(cookieName, domain, path, doc) {
- var deleted = this._maybeDeleteCookie(cookieName, domain, path, doc);
- if (deleted) return true;
- var dotIndex = domain.indexOf(".");
- if (dotIndex == 0) {
- return this._recursivelyDeleteCookieDomains(cookieName, domain.substring(1), path, doc);
- } else if (dotIndex != -1) {
- return this._recursivelyDeleteCookieDomains(cookieName, domain.substring(dotIndex), path, doc);
- } else {
- // No more dots; try just not passing in a domain at all
- return this._maybeDeleteCookie(cookieName, null, path, doc);
- }
-}
-
-BrowserBot.prototype._recursivelyDeleteCookie = function(cookieName, domain, path, doc) {
- var slashIndex = path.lastIndexOf("/");
- var finalIndex = path.length-1;
- if (slashIndex == finalIndex) {
- slashIndex--;
- }
- if (slashIndex != -1) {
- deleted = this._recursivelyDeleteCookie(cookieName, domain, path.substring(0, slashIndex+1), doc);
- if (deleted) return true;
- }
- return this._recursivelyDeleteCookieDomains(cookieName, domain, path, doc);
-}
-
-BrowserBot.prototype.recursivelyDeleteCookie = function(cookieName, domain, path, win) {
- if (!win) win = this.getCurrentWindow();
- var doc = win.document;
- if (!domain) {
- domain = doc.domain;
- }
- if (!path) {
- path = win.location.pathname;
- }
- var deleted = this._recursivelyDeleteCookie(cookieName, "." + domain, path, doc);
- if (deleted) return;
- // Finally try a null path (Try it last because it's uncommon)
- deleted = this._recursivelyDeleteCookieDomains(cookieName, "." + domain, null, doc);
- if (deleted) return;
- throw new SeleniumError("Couldn't delete cookie " + cookieName);
-}
-
-/*
- * Finds an element recursively in frames and nested frames
- * in the specified document, using various lookup protocols
- */
-BrowserBot.prototype.findElementRecursive = function(locatorType, locatorString, inDocument, inWindow) {
-
- var element = this.findElementBy(locatorType, locatorString, inDocument, inWindow);
- if (element != null) {
- return element;
- }
-
- for (var i = 0; i < inWindow.frames.length; i++) {
- // On some browsers, the document object is undefined for third-party
- // frames. Make sure the document is valid before continuing.
- if (inWindow.frames[i].document) {
- element = this.findElementRecursive(locatorType, locatorString, inWindow.frames[i].document, inWindow.frames[i]);
-
- if (element != null) {
- return element;
- }
- }
- }
-};
-
-/*
-* Finds an element on the current page, using various lookup protocols
-*/
-BrowserBot.prototype.findElementOrNull = function(locator, win) {
- locator = parse_locator(locator);
-
- if (win == null) {
- win = this.getCurrentWindow();
- }
- var element = this.findElementRecursive(locator.type, locator.string, win.document, win);
-
- if (element != null) {
- return this.browserbot.highlight(element);
- }
-
- // Element was not found by any locator function.
- return null;
-};
-
-BrowserBot.prototype.findElement = function(locator, win) {
- var element = this.findElementOrNull(locator, win);
- if (element == null) throw new SeleniumError("Element " + locator + " not found");
- return element;
-}
-
-/**
- * In non-IE browsers, getElementById() does not search by name. Instead, we
- * we search separately by id and name.
- */
-BrowserBot.prototype.locateElementByIdentifier = function(identifier, inDocument, inWindow) {
- return BrowserBot.prototype.locateElementById(identifier, inDocument, inWindow)
- || BrowserBot.prototype.locateElementByName(identifier, inDocument, inWindow)
- || null;
-};
-
-/**
- * Find the element with id - can't rely on getElementById, coz it returns by name as well in IE..
- */
-BrowserBot.prototype.locateElementById = function(identifier, inDocument, inWindow) {
- var element = inDocument.getElementById(identifier);
- if (element && element.getAttribute('id') === identifier) {
- return element;
- }
- else if (browserVersion.isIE || browserVersion.isOpera) {
- // SEL-484
- var xpath = '/descendant::*[@id=' + identifier.quoteForXPath() + ']';
- return BrowserBot.prototype
- .locateElementByXPath(xpath, inDocument, inWindow);
- }
- else {
- return null;
- }
-};
-
-/**
- * Find an element by name, refined by (optional) element-filter
- * expressions.
- */
-BrowserBot.prototype.locateElementByName = function(locator, document, inWindow) {
- var elements = document.getElementsByTagName("*");
-
- var filters = locator.split(' ');
- filters[0] = 'name=' + filters[0];
-
- while (filters.length) {
- var filter = filters.shift();
- elements = this.selectElements(filter, elements, 'value');
- }
-
- if (elements.length > 0) {
- return elements[0];
- }
- return null;
-};
-
-/**
- * Finds an element using by evaluating the specfied string.
- */
-BrowserBot.prototype.locateElementByDomTraversal = function(domTraversal, document, window) {
-
- var browserbot = this.browserbot;
- var element = null;
- try {
- element = eval(domTraversal);
- } catch (e) {
- return null;
- }
-
- if (!element) {
- return null;
- }
-
- return element;
-};
-BrowserBot.prototype.locateElementByDomTraversal.prefix = "dom";
-
-/**
- * Finds an element identified by the xpath expression. Expressions _must_
- * begin with "//".
- */
-BrowserBot.prototype.locateElementByXPath = function(xpath, inDocument, inWindow) {
- var results = eval_xpath(xpath, inDocument, {
- returnOnFirstMatch : true,
- ignoreAttributesWithoutValue: this.ignoreAttributesWithoutValue,
- allowNativeXpath : this.allowNativeXpath,
- xpathLibrary : this.xpathLibrary,
- namespaceResolver : this._namespaceResolver
- });
- return (results.length > 0) ? results[0] : null;
-};
-
-BrowserBot.prototype._namespaceResolver = function(prefix) {
- if (prefix == 'html' || prefix == 'xhtml' || prefix == 'x') {
- return 'http://www.w3.org/1999/xhtml';
- } else if (prefix == 'mathml') {
- return 'http://www.w3.org/1998/Math/MathML';
- } else {
- throw new Error("Unknown namespace: " + prefix + ".");
- }
-}
-
-/**
- * Returns the number of xpath results.
- */
-BrowserBot.prototype.evaluateXPathCount = function(xpath, inDocument) {
- var results = eval_xpath(xpath, inDocument, {
- ignoreAttributesWithoutValue: this.ignoreAttributesWithoutValue,
- allowNativeXpath : this.allowNativeXpath,
- xpathLibrary : this.xpathLibrary,
- namespaceResolver : this._namespaceResolver
- });
- return results.length;
-};
-
-/**
- * Finds a link element with text matching the expression supplied. Expressions must
- * begin with "link:".
- */
-BrowserBot.prototype.locateElementByLinkText = function(linkText, inDocument, inWindow) {
- var links = inDocument.getElementsByTagName('a');
- for (var i = 0; i < links.length; i++) {
- var element = links[i];
- if (PatternMatcher.matches(linkText, getText(element))) {
- return element;
- }
- }
- return null;
-};
-BrowserBot.prototype.locateElementByLinkText.prefix = "link";
-
-/**
- * Returns an attribute based on an attribute locator. This is made up of an element locator
- * suffixed with @attribute-name.
- */
-BrowserBot.prototype.findAttribute = function(locator) {
- // Split into locator + attributeName
- var attributePos = locator.lastIndexOf("@");
- var elementLocator = locator.slice(0, attributePos);
- var attributeName = locator.slice(attributePos + 1);
-
- // Find the element.
- var element = this.findElement(elementLocator);
-
- // Handle missing "class" attribute in IE.
- if (browserVersion.isIE && attributeName == "class") {
- attributeName = "className";
- }
-
- // Get the attribute value.
- var attributeValue = element.getAttribute(attributeName);
-
- // IE returns an object for the "style" attribute
- if (attributeName == 'style' && typeof(attributeValue) != 'string') {
- attributeValue = attributeValue.cssText;
- }
-
- return attributeValue ? attributeValue.toString() : null;
-};
-
-/*
-* Select the specified option and trigger the relevant events of the element.
-*/
-BrowserBot.prototype.selectOption = function(element, optionToSelect) {
- triggerEvent(element, 'focus', false);
- var changed = false;
- for (var i = 0; i < element.options.length; i++) {
- var option = element.options[i];
- if (option.selected && option != optionToSelect) {
- option.selected = false;
- changed = true;
- }
- else if (!option.selected && option == optionToSelect) {
- option.selected = true;
- changed = true;
- }
- }
-
- if (changed) {
- triggerEvent(element, 'change', true);
- }
-};
-
-/*
-* Select the specified option and trigger the relevant events of the element.
-*/
-BrowserBot.prototype.addSelection = function(element, option) {
- this.checkMultiselect(element);
- triggerEvent(element, 'focus', false);
- if (!option.selected) {
- option.selected = true;
- triggerEvent(element, 'change', true);
- }
-};
-
-/*
-* Select the specified option and trigger the relevant events of the element.
-*/
-BrowserBot.prototype.removeSelection = function(element, option) {
- this.checkMultiselect(element);
- triggerEvent(element, 'focus', false);
- if (option.selected) {
- option.selected = false;
- triggerEvent(element, 'change', true);
- }
-};
-
-BrowserBot.prototype.checkMultiselect = function(element) {
- if (!element.multiple)
- {
- throw new SeleniumError("Not a multi-select");
- }
-
-};
-
-BrowserBot.prototype.replaceText = function(element, stringValue) {
- triggerEvent(element, 'focus', false);
- triggerEvent(element, 'select', true);
- var maxLengthAttr = element.getAttribute("maxLength");
- var actualValue = stringValue;
- if (maxLengthAttr != null) {
- var maxLength = parseInt(maxLengthAttr);
- if (stringValue.length > maxLength) {
- actualValue = stringValue.substr(0, maxLength);
- }
- }
-
- if (getTagName(element) == "body") {
- if (element.ownerDocument && element.ownerDocument.designMode) {
- var designMode = new String(element.ownerDocument.designMode).toLowerCase();
- if (designMode = "on") {
- // this must be a rich text control!
- element.innerHTML = actualValue;
- }
- }
- } else {
- element.value = actualValue;
- }
- // DGF this used to be skipped in chrome URLs, but no longer. Is xpcnativewrappers to blame?
- try {
- triggerEvent(element, 'change', true);
- } catch (e) {}
-};
-
-BrowserBot.prototype.submit = function(formElement) {
- var actuallySubmit = true;
- this._modifyElementTarget(formElement);
- if (formElement.onsubmit) {
- if (browserVersion.isHTA) {
- // run the code in the correct window so alerts are handled correctly even in HTA mode
- var win = this.browserbot.getCurrentWindow();
- var now = new Date().getTime();
- var marker = 'marker' + now;
- win[marker] = formElement;
- win.setTimeout("var actuallySubmit = "+marker+".onsubmit();" +
- "if (actuallySubmit) { " +
- marker+".submit(); " +
- "if ("+marker+".target && !/^_/.test("+marker+".target)) {"+
- "window.open('', "+marker+".target);"+
- "}"+
- "};"+
- marker+"=null", 0);
- // pause for up to 2s while this command runs
- var terminationCondition = function () {
- return !win[marker];
- }
- return Selenium.decorateFunctionWithTimeout(terminationCondition, 2000);
- } else {
- actuallySubmit = formElement.onsubmit();
- if (actuallySubmit) {
- formElement.submit();
- if (formElement.target && !/^_/.test(formElement.target)) {
- this.browserbot.openWindow('', formElement.target);
- }
- }
- }
- } else {
- formElement.submit();
- }
-}
-
-BrowserBot.prototype.clickElement = function(element, clientX, clientY) {
- this._fireEventOnElement("click", element, clientX, clientY);
-};
-
-BrowserBot.prototype.doubleClickElement = function(element, clientX, clientY) {
- this._fireEventOnElement("dblclick", element, clientX, clientY);
-};
-
-// The contextmenu event is fired when the user right-clicks to open the context menu
-BrowserBot.prototype.contextMenuOnElement = function(element, clientX, clientY) {
- this._fireEventOnElement("contextmenu", element, clientX, clientY);
-};
-
-BrowserBot.prototype._modifyElementTarget = function(element) {
- if (element.target) {
- if (element.target == "_blank" || /^selenium_blank/.test(element.target) ) {
- var tagName = getTagName(element);
- if (tagName == "a" || tagName == "form") {
- var newTarget = "selenium_blank" + Math.round(100000 * Math.random());
- LOG.warn("Link has target '_blank', which is not supported in Selenium! Randomizing target to be: " + newTarget);
- this.browserbot.openWindow('', newTarget);
- element.target = newTarget;
- }
- }
- }
-}
-
-
-BrowserBot.prototype._handleClickingImagesInsideLinks = function(targetWindow, element) {
- var itrElement = element;
- while (itrElement != null) {
- if (itrElement.href) {
- targetWindow.location.href = itrElement.href;
- break;
- }
- itrElement = itrElement.parentNode;
- }
-}
-
-BrowserBot.prototype._getTargetWindow = function(element) {
- var targetWindow = element.ownerDocument.defaultView;
- if (element.target) {
- targetWindow = this._getFrameFromGlobal(element.target);
- }
- return targetWindow;
-}
-
-BrowserBot.prototype._getFrameFromGlobal = function(target) {
-
- if (target == "_self") {
- return this.getCurrentWindow();
- }
- if (target == "_top") {
- return this.topFrame;
- } else if (target == "_parent") {
- return this.getCurrentWindow().parent;
- } else if (target == "_blank") {
- // TODO should this set cleverer window defaults?
- return this.getCurrentWindow().open('', '_blank');
- }
- var frameElement = this.findElementBy("implicit", target, this.topFrame.document, this.topFrame);
- if (frameElement) {
- return frameElement.contentWindow;
- }
- var win = this.getWindowByName(target);
- if (win) return win;
- return this.getCurrentWindow().open('', target);
-}
-
-
-BrowserBot.prototype.bodyText = function() {
- if (!this.getDocument().body) {
- throw new SeleniumError("Couldn't access document.body. Is this HTML page fully loaded?");
- }
- return getText(this.getDocument().body);
-};
-
-BrowserBot.prototype.getAllButtons = function() {
- var elements = this.getDocument().getElementsByTagName('input');
- var result = [];
-
- for (var i = 0; i < elements.length; i++) {
- if (elements[i].type == 'button' || elements[i].type == 'submit' || elements[i].type == 'reset') {
- result.push(elements[i].id);
- }
- }
-
- return result;
-};
-
-
-BrowserBot.prototype.getAllFields = function() {
- var elements = this.getDocument().getElementsByTagName('input');
- var result = [];
-
- for (var i = 0; i < elements.length; i++) {
- if (elements[i].type == 'text') {
- result.push(elements[i].id);
- }
- }
-
- return result;
-};
-
-BrowserBot.prototype.getAllLinks = function() {
- var elements = this.getDocument().getElementsByTagName('a');
- var result = [];
-
- for (var i = 0; i < elements.length; i++) {
- result.push(elements[i].id);
- }
-
- return result;
-};
-
-function isDefined(value) {
- return typeof(value) != undefined;
-}
-
-BrowserBot.prototype.goBack = function() {
- this.getCurrentWindow().history.back();
-};
-
-BrowserBot.prototype.goForward = function() {
- this.getCurrentWindow().history.forward();
-};
-
-BrowserBot.prototype.close = function() {
- if (browserVersion.isIE) {
- // fix "do you want to close this window" warning in IE
- // You can only close windows that you have opened.
- // So, let's "open" it.
- try {
- this.topFrame.name=new Date().getTime();
- window.open("", this.topFrame.name, "");
- this.topFrame.close();
- return;
- } catch (e) {}
- }
- if (browserVersion.isChrome || browserVersion.isSafari || browserVersion.isOpera) {
- this.topFrame.close();
- } else {
- this.getCurrentWindow().eval("window.top.close();");
- }
-};
-
-BrowserBot.prototype.refresh = function() {
- this.getCurrentWindow().location.reload(true);
-};
-
-/**
- * Refine a list of elements using a filter.
- */
-BrowserBot.prototype.selectElementsBy = function(filterType, filter, elements) {
- var filterFunction = BrowserBot.filterFunctions[filterType];
- if (! filterFunction) {
- throw new SeleniumError("Unrecognised element-filter type: '" + filterType + "'");
- }
-
- return filterFunction(filter, elements);
-};
-
-BrowserBot.filterFunctions = {};
-
-BrowserBot.filterFunctions.name = function(name, elements) {
- var selectedElements = [];
- for (var i = 0; i < elements.length; i++) {
- if (elements[i].name === name) {
- selectedElements.push(elements[i]);
- }
- }
- return selectedElements;
-};
-
-BrowserBot.filterFunctions.value = function(value, elements) {
- var selectedElements = [];
- for (var i = 0; i < elements.length; i++) {
- if (elements[i].value === value) {
- selectedElements.push(elements[i]);
- }
- }
- return selectedElements;
-};
-
-BrowserBot.filterFunctions.index = function(index, elements) {
- index = Number(index);
- if (isNaN(index) || index < 0) {
- throw new SeleniumError("Illegal Index: " + index);
- }
- if (elements.length <= index) {
- throw new SeleniumError("Index out of range: " + index);
- }
- return [elements[index]];
-};
-
-BrowserBot.prototype.selectElements = function(filterExpr, elements, defaultFilterType) {
-
- var filterType = (defaultFilterType || 'value');
-
- // If there is a filter prefix, use the specified strategy
- var result = filterExpr.match(/^([A-Za-z]+)=(.+)/);
- if (result) {
- filterType = result[1].toLowerCase();
- filterExpr = result[2];
- }
-
- return this.selectElementsBy(filterType, filterExpr, elements);
-};
-
-/**
- * Find an element by class
- */
-BrowserBot.prototype.locateElementByClass = function(locator, document) {
- return elementFindFirstMatchingChild(document,
- function(element) {
- return element.className == locator
- }
- );
-}
-
-/**
- * Find an element by alt
- */
-BrowserBot.prototype.locateElementByAlt = function(locator, document) {
- return elementFindFirstMatchingChild(document,
- function(element) {
- return element.alt == locator
- }
- );
-}
-
-/**
- * Find an element by css selector
- */
-BrowserBot.prototype.locateElementByCss = function(locator, document) {
- var elements = eval_css(locator, document);
- if (elements.length != 0)
- return elements[0];
- return null;
-}
-
-/**
- * This function is responsible for mapping a UI specifier string to an element
- * on the page, and returning it. If no element is found, null is returned.
- * Returning null on failure to locate the element is part of the undocumented
- * API for locator strategies.
- */
-BrowserBot.prototype.locateElementByUIElement = function(locator, inDocument) {
- // offset locators are delimited by "->", which is much simpler than the
- // previous scheme involving detecting the close-paren.
- var locators = locator.split(/->/, 2);
-
- var locatedElement = null;
- var pageElements = UIMap.getInstance()
- .getPageElements(locators[0], inDocument);
-
- if (locators.length > 1) {
- for (var i = 0; i < pageElements.length; ++i) {
- var locatedElements = eval_locator(locators[1], inDocument,
- pageElements[i]);
- if (locatedElements.length) {
- locatedElement = locatedElements[0];
- break;
- }
- }
- }
- else if (pageElements.length) {
- locatedElement = pageElements[0];
- }
-
- return locatedElement;
-}
-
-BrowserBot.prototype.locateElementByUIElement.prefix = 'ui';
-
-// define a function used to compare the result of a close UI element
-// match with the actual interacted element. If they are close enough
-// according to the heuristic, consider them a match.
-/**
- * A heuristic function for comparing a node with a target node. Typically the
- * node is specified in a UI element definition, while the target node is
- * returned by the recorder as the leaf element which had some event enacted
- * upon it. This particular heuristic covers the case where the anchor element
- * contains other inline tags, such as "em" or "img".
- *
- * @param node the node being compared to the target node
- * @param target the target node
- * @return true if node equals target, or if node is a link
- * element and target is its descendant, or if node has
- * an onclick attribute and target is its descendant.
- * False otherwise.
- */
-BrowserBot.prototype.locateElementByUIElement.is_fuzzy_match = function(node, target) {
- try {
- var isMatch = (
- (node == target) ||
- ((node.nodeName == 'A' || node.onclick) && is_ancestor(node, target))
- );
- return isMatch;
- }
- catch (e) {
- return false;
- }
-};
-
-/*****************************************************************/
-/* BROWSER-SPECIFIC FUNCTIONS ONLY AFTER THIS LINE */
-
-function MozillaBrowserBot(frame) {
- BrowserBot.call(this, frame);
-}
-objectExtend(MozillaBrowserBot.prototype, BrowserBot.prototype);
-
-function KonquerorBrowserBot(frame) {
- BrowserBot.call(this, frame);
-}
-objectExtend(KonquerorBrowserBot.prototype, BrowserBot.prototype);
-
-KonquerorBrowserBot.prototype.setIFrameLocation = function(iframe, location) {
- // Window doesn't fire onload event when setting src to the current value,
- // so we set it to blank first.
- iframe.src = "about:blank";
- iframe.src = location;
-};
-
-KonquerorBrowserBot.prototype.setOpenLocation = function(win, loc) {
- // Window doesn't fire onload event when setting src to the current value,
- // so we just refresh in that case instead.
- loc = absolutify(loc, this.baseUrl);
- loc = canonicalize(loc);
- var startUrl = win.location.href;
- if ("about:blank" != win.location.href) {
- var startLoc = parseUrl(win.location.href);
- startLoc.hash = null;
- var startUrl = reassembleLocation(startLoc);
- }
- LOG.debug("startUrl="+startUrl);
- LOG.debug("win.location.href="+win.location.href);
- LOG.debug("loc="+loc);
- if (startUrl == loc) {
- LOG.debug("opening exact same location");
- this.refresh();
- } else {
- LOG.debug("locations differ");
- win.location.href = loc;
- }
- // force the current polling thread to detect a page load
- var marker = this.isPollingForLoad(win);
- if (marker) {
- delete win.location[marker];
- }
-};
-
-KonquerorBrowserBot.prototype._isSameDocument = function(originalDocument, currentDocument) {
- // under Konqueror, there may be this case:
- // originalDocument and currentDocument are different objects
- // while their location are same.
- if (originalDocument) {
- return originalDocument.location == currentDocument.location
- } else {
- return originalDocument === currentDocument;
- }
-};
-
-function SafariBrowserBot(frame) {
- BrowserBot.call(this, frame);
-}
-objectExtend(SafariBrowserBot.prototype, BrowserBot.prototype);
-
-SafariBrowserBot.prototype.setIFrameLocation = KonquerorBrowserBot.prototype.setIFrameLocation;
-SafariBrowserBot.prototype.setOpenLocation = KonquerorBrowserBot.prototype.setOpenLocation;
-
-
-function OperaBrowserBot(frame) {
- BrowserBot.call(this, frame);
-}
-objectExtend(OperaBrowserBot.prototype, BrowserBot.prototype);
-OperaBrowserBot.prototype.setIFrameLocation = function(iframe, location) {
- if (iframe.src == location) {
- iframe.src = location + '?reload';
- } else {
- iframe.src = location;
- }
-}
-
-function IEBrowserBot(frame) {
- BrowserBot.call(this, frame);
-}
-objectExtend(IEBrowserBot.prototype, BrowserBot.prototype);
-
-IEBrowserBot.prototype._handleClosedSubFrame = function(testWindow, doNotModify) {
- if (this.proxyInjectionMode) {
- return testWindow;
- }
-
- try {
- testWindow.location.href;
- this.permDenied = 0;
- } catch (e) {
- this.permDenied++;
- }
- if (this._windowClosed(testWindow) || this.permDenied > 4) {
- if (this.isSubFrameSelected) {
- LOG.warn("Current subframe appears to have closed; selecting top frame");
- this.selectFrame("relative=top");
- return this.getCurrentWindow(doNotModify);
- } else {
- var closedError = new SeleniumError("Current window or frame is closed!");
- closedError.windowClosed = true;
- throw closedError;
- }
- }
- return testWindow;
-};
-
-IEBrowserBot.prototype.modifyWindowToRecordPopUpDialogs = function(windowToModify, browserBot) {
- BrowserBot.prototype.modifyWindowToRecordPopUpDialogs(windowToModify, browserBot);
-
- // we will call the previous version of this method from within our own interception
- oldShowModalDialog = windowToModify.showModalDialog;
-
- windowToModify.showModalDialog = function(url, args, features) {
- // Get relative directory to where TestRunner.html lives
- // A risky assumption is that the user's TestRunner is named TestRunner.html
- var doc_location = document.location.toString();
- var end_of_base_ref = doc_location.indexOf('TestRunner.html');
- var base_ref = doc_location.substring(0, end_of_base_ref);
- var runInterval = '';
-
- // Only set run interval if options is defined
- if (typeof(window.runOptions) != 'undefined') {
- runInterval = "&runInterval=" + runOptions.runInterval;
- }
-
- var testRunnerURL = "TestRunner.html?auto=true&singletest="
- + escape(browserBot.modalDialogTest)
- + "&autoURL="
- + escape(url)
- + runInterval;
- var fullURL = base_ref + testRunnerURL;
- browserBot.modalDialogTest = null;
-
- // If using proxy injection mode
- if (this.proxyInjectionMode) {
- var sessionId = runOptions.getSessionId();
- if (sessionId == undefined) {
- sessionId = injectedSessionId;
- }
- if (sessionId != undefined) {
- LOG.debug("Invoking showModalDialog and injecting URL " + fullURL);
- }
- fullURL = url;
- }
- var returnValue = oldShowModalDialog(fullURL, args, features);
- return returnValue;
- };
-};
-
-IEBrowserBot.prototype.modifySeparateTestWindowToDetectPageLoads = function(windowObject) {
- this.pageUnloading = false;
- var self = this;
- var pageUnloadDetector = function() {
- self.pageUnloading = true;
- };
- windowObject.attachEvent("onbeforeunload", pageUnloadDetector);
- BrowserBot.prototype.modifySeparateTestWindowToDetectPageLoads.call(this, windowObject);
-};
-
-IEBrowserBot.prototype.pollForLoad = function(loadFunction, windowObject, originalDocument, originalLocation, originalHref, marker) {
- LOG.debug("IEBrowserBot.pollForLoad: " + marker);
- if (!this.permDeniedCount[marker]) this.permDeniedCount[marker] = 0;
- BrowserBot.prototype.pollForLoad.call(this, loadFunction, windowObject, originalDocument, originalLocation, originalHref, marker);
- if (this.pageLoadError) {
- if (this.pageUnloading) {
- var self = this;
- LOG.debug("pollForLoad UNLOADING (" + marker + "): caught exception while firing events on unloading page: " + this.pageLoadError.message);
- this.reschedulePoller(loadFunction, windowObject, originalDocument, originalLocation, originalHref, marker);
- this.pageLoadError = null;
- return;
- } else if (((this.pageLoadError.message == "Permission denied") || (/^Access is denied/.test(this.pageLoadError.message)))
- && this.permDeniedCount[marker]++ < 8) {
- if (this.permDeniedCount[marker] > 4) {
- var canAccessThisWindow;
- var canAccessCurrentlySelectedWindow;
- try {
- windowObject.location.href;
- canAccessThisWindow = true;
- } catch (e) {}
- try {
- this.getCurrentWindow(true).location.href;
- canAccessCurrentlySelectedWindow = true;
- } catch (e) {}
- if (canAccessCurrentlySelectedWindow & !canAccessThisWindow) {
- LOG.debug("pollForLoad (" + marker + ") ABORTING: " + this.pageLoadError.message + " (" + this.permDeniedCount[marker] + "), but the currently selected window is fine");
- // returning without rescheduling
- this.pageLoadError = null;
- return;
- }
- }
-
- var self = this;
- LOG.debug("pollForLoad (" + marker + "): " + this.pageLoadError.message + " (" + this.permDeniedCount[marker] + "), waiting to see if it goes away");
- this.reschedulePoller(loadFunction, windowObject, originalDocument, originalLocation, originalHref, marker);
- this.pageLoadError = null;
- return;
- }
- //handy for debugging!
- //throw this.pageLoadError;
- }
-};
-
-IEBrowserBot.prototype._windowClosed = function(win) {
- try {
- var c = win.closed;
- // frame windows claim to be non-closed when their parents are closed
- // but you can't access their document objects in that case
- if (!c) {
- try {
- win.document;
- } catch (de) {
- if (de.message == "Permission denied") {
- // the window is probably unloading, which means it's probably not closed yet
- return false;
- }
- else if (/^Access is denied/.test(de.message)) {
- // rare variation on "Permission denied"?
- LOG.debug("IEBrowserBot.windowClosed: got " + de.message + " (this.pageUnloading=" + this.pageUnloading + "); assuming window is unloading, probably not closed yet");
- return false;
- } else {
- // this is probably one of those frame window situations
- LOG.debug("IEBrowserBot.windowClosed: couldn't read win.document, assume closed: " + de.message + " (this.pageUnloading=" + this.pageUnloading + ")");
- return true;
- }
- }
- }
- if (c == null) {
- LOG.debug("IEBrowserBot.windowClosed: win.closed was null, assuming closed");
- return true;
- }
- return c;
- } catch (e) {
- LOG.debug("IEBrowserBot._windowClosed: Got an exception trying to read win.closed; we'll have to take a guess!");
-
- if (browserVersion.isHTA) {
- if (e.message == "Permission denied") {
- // the window is probably unloading, which means it's not closed yet
- return false;
- } else {
- // there's a good chance that we've lost contact with the window object if it is closed
- return true;
- }
- } else {
- // the window is probably unloading, which means it's not closed yet
- return false;
- }
- }
-};
-
-/**
- * In IE, getElementById() also searches by name - this is an optimisation for IE.
- */
-IEBrowserBot.prototype.locateElementByIdentifer = function(identifier, inDocument, inWindow) {
- return inDocument.getElementById(identifier);
-};
-
-SafariBrowserBot.prototype.modifyWindowToRecordPopUpDialogs = function(windowToModify, browserBot) {
- BrowserBot.prototype.modifyWindowToRecordPopUpDialogs(windowToModify, browserBot);
-
- var originalOpen = windowToModify.open;
- /*
- * Safari seems to be broken, so that when we manually trigger the onclick method
- * of a button/href, any window.open calls aren't resolved relative to the app location.
- * So here we replace the open() method with one that does resolve the url correctly.
- */
- windowToModify.open = function(url, windowName, windowFeatures, replaceFlag) {
-
- if (url.startsWith("http://") || url.startsWith("https://") || url.startsWith("/")) {
- return originalOpen(url, windowName, windowFeatures, replaceFlag);
- }
-
- // Reduce the current path to the directory
- var currentPath = windowToModify.location.pathname || "/";
- currentPath = currentPath.replace(/\/[^\/]*$/, "/");
-
- // Remove any leading "./" from the new url.
- url = url.replace(/^\.\//, "");
-
- newUrl = currentPath + url;
-
- var openedWindow = originalOpen(newUrl, windowName, windowFeatures, replaceFlag);
- LOG.debug("window.open call intercepted; window ID (which you can use with selectWindow()) is \"" + windowName + "\"");
- if (windowName!=null) {
- openedWindow["seleniumWindowName"] = windowName;
- }
- return openedWindow;
- };
-};
-
-MozillaBrowserBot.prototype._fireEventOnElement = function(eventType, element, clientX, clientY) {
- var win = this.getCurrentWindow();
- triggerEvent(element, 'focus', false);
-
- // Add an event listener that detects if the default action has been prevented.
- // (This is caused by a javascript onclick handler returning false)
- // we capture the whole event, rather than the getPreventDefault() state at the time,
- // because we need to let the entire event bubbling and capturing to go through
- // before making a decision on whether we should force the href
- var savedEvent = null;
-
- element.addEventListener(eventType, function(evt) {
- savedEvent = evt;
- }, false);
-
- this._modifyElementTarget(element);
-
- // Trigger the event.
- this.browserbot.triggerMouseEvent(element, eventType, true, clientX, clientY);
-
- if (this._windowClosed(win)) {
- return;
- }
-
- // Perform the link action if preventDefault was set.
- // In chrome URL, the link action is already executed by triggerMouseEvent.
- if (!browserVersion.isChrome && savedEvent != null && !savedEvent.getPreventDefault()) {
- var targetWindow = this.browserbot._getTargetWindow(element);
- if (element.href) {
- targetWindow.location.href = element.href;
- } else {
- this.browserbot._handleClickingImagesInsideLinks(targetWindow, element);
- }
- }
-
-};
-
-
-OperaBrowserBot.prototype._fireEventOnElement = function(eventType, element, clientX, clientY) {
- var win = this.getCurrentWindow();
- triggerEvent(element, 'focus', false);
-
- this._modifyElementTarget(element);
-
- // Trigger the click event.
- this.browserbot.triggerMouseEvent(element, eventType, true, clientX, clientY);
-
- if (this._windowClosed(win)) {
- return;
- }
-
-};
-
-
-KonquerorBrowserBot.prototype._fireEventOnElement = function(eventType, element, clientX, clientY) {
- var win = this.getCurrentWindow();
- triggerEvent(element, 'focus', false);
-
- this._modifyElementTarget(element);
-
- if (element[eventType]) {
- element[eventType]();
- }
- else {
- this.browserbot.triggerMouseEvent(element, eventType, true, clientX, clientY);
- }
-
- if (this._windowClosed(win)) {
- return;
- }
-
-};
-
-SafariBrowserBot.prototype._fireEventOnElement = function(eventType, element, clientX, clientY) {
- triggerEvent(element, 'focus', false);
- var wasChecked = element.checked;
-
- this._modifyElementTarget(element);
-
- // For form element it is simple.
- if (element[eventType]) {
- element[eventType]();
- }
- // For links and other elements, event emulation is required.
- else {
- var targetWindow = this.browserbot._getTargetWindow(element);
- // todo: deal with anchors?
- this.browserbot.triggerMouseEvent(element, eventType, true, clientX, clientY);
-
- }
-
-};
-
-SafariBrowserBot.prototype.refresh = function() {
- var win = this.getCurrentWindow();
- if (win.location.hash) {
- // DGF Safari refuses to refresh when there's a hash symbol in the URL
- win.location.hash = "";
- var actuallyReload = function() {
- win.location.reload(true);
- }
- window.setTimeout(actuallyReload, 1);
- } else {
- win.location.reload(true);
- }
-};
-
-IEBrowserBot.prototype._fireEventOnElement = function(eventType, element, clientX, clientY) {
- var win = this.getCurrentWindow();
- triggerEvent(element, 'focus', false);
-
- var wasChecked = element.checked;
-
- // Set a flag that records if the page will unload - this isn't always accurate, because
- // triggers the onbeforeunload event, even thought the page won't unload
- var pageUnloading = false;
- var pageUnloadDetector = function() {
- pageUnloading = true;
- };
- win.attachEvent("onbeforeunload", pageUnloadDetector);
- this._modifyElementTarget(element);
- if (element[eventType]) {
- element[eventType]();
- }
- else {
- this.browserbot.triggerMouseEvent(element, eventType, true, clientX, clientY);
- }
-
-
- // If the page is going to unload - still attempt to fire any subsequent events.
- // However, we can't guarantee that the page won't unload half way through, so we need to handle exceptions.
- try {
- win.detachEvent("onbeforeunload", pageUnloadDetector);
-
- if (this._windowClosed(win)) {
- return;
- }
-
- // Onchange event is not triggered automatically in IE.
- if (isDefined(element.checked) && wasChecked != element.checked) {
- triggerEvent(element, 'change', true);
- }
-
- }
- catch (e) {
- // If the page is unloading, we may get a "Permission denied" or "Unspecified error".
- // Just ignore it, because the document may have unloaded.
- if (pageUnloading) {
- LOG.logHook = function() {
- };
- LOG.warn("Caught exception when firing events on unloading page: " + e.message);
- return;
- }
- throw e;
- }
-};
diff --git a/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-browserdetect.js b/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-browserdetect.js
deleted file mode 100644
index 825521f0..00000000
--- a/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-browserdetect.js
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Copyright 2004 ThoughtWorks, Inc
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// Although it's generally better web development practice not to use
-// browser-detection (feature detection is better), the subtle browser
-// differences that Selenium has to work around seem to make it
-// necessary. Maybe as we learn more about what we need, we can do this in
-// a more "feature-centric" rather than "browser-centric" way.
-
-var BrowserVersion = function() {
- this.name = navigator.appName;
-
- if (navigator.userAgent.indexOf('Mac OS X') != -1) {
- this.isOSX = true;
- }
-
- if (navigator.userAgent.indexOf('Windows NT 6') != -1) {
- this.isVista = true;
- }
-
- if (window.opera != null) {
- this.browser = BrowserVersion.OPERA;
- this.isOpera = true;
- return;
- }
-
- var _getQueryParameter = function(searchKey) {
- var str = location.search.substr(1);
- if (str == null) return null;
- var clauses = str.split('&');
- for (var i = 0; i < clauses.length; i++) {
- var keyValuePair = clauses[i].split('=', 2);
- var key = unescape(keyValuePair[0]);
- if (key == searchKey) {
- return unescape(keyValuePair[1]);
- }
- }
- return null;
- };
-
- var self = this;
-
- var checkChrome = function() {
- var loc = window.document.location.href;
- try {
- loc = window.top.document.location.href;
- if (/^chrome:\/\//.test(loc)) {
- self.isChrome = true;
- } else {
- self.isChrome = false;
- }
- } catch (e) {
- // can't see the top (that means we might be chrome, but it's impossible to be sure)
- self.isChromeDetectable = "no, top location couldn't be read in this window";
- if (_getQueryParameter('thisIsChrome')) {
- self.isChrome = true;
- } else {
- self.isChrome = false;
- }
- }
-
-
- }
-
-
-
- if (this.name == "Microsoft Internet Explorer") {
- this.browser = BrowserVersion.IE;
- this.isIE = true;
- try {
- if (window.top.SeleniumHTARunner && window.top.document.location.pathname.match(/.hta$/i)) {
- this.isHTA = true;
- }
- } catch (e) {
- this.isHTADetectable = "no, top location couldn't be read in this window";
- if (_getQueryParameter('thisIsHTA')) {
- self.isHTA = true;
- } else {
- self.isHTA = false;
- }
- }
- if (navigator.appVersion.match(/MSIE 6.0/)) {
- this.isIE6 = true;
- }
- if ("0" == navigator.appMinorVersion) {
- this.preSV1 = true;
- if (this.isIE6) {
- this.appearsToBeBrokenInitialIE6 = true;
- }
- }
- return;
- }
-
- if (navigator.userAgent.indexOf('Safari') != -1) {
- this.browser = BrowserVersion.SAFARI;
- this.isSafari = true;
- this.khtml = true;
- return;
- }
-
- if (navigator.userAgent.indexOf('Konqueror') != -1) {
- this.browser = BrowserVersion.KONQUEROR;
- this.isKonqueror = true;
- this.khtml = true;
- return;
- }
-
- if (navigator.userAgent.indexOf('Firefox') != -1) {
- this.browser = BrowserVersion.FIREFOX;
- this.isFirefox = true;
- this.isGecko = true;
- var result = /.*Firefox\/([\d\.]+).*/.exec(navigator.userAgent);
- if (result) {
- this.firefoxVersion = result[1];
- }
- checkChrome();
- return;
- }
-
- if (navigator.userAgent.indexOf('Gecko') != -1) {
- this.browser = BrowserVersion.MOZILLA;
- this.isMozilla = true;
- this.isGecko = true;
- checkChrome();
- return;
- }
-
- this.browser = BrowserVersion.UNKNOWN;
-}
-
-BrowserVersion.OPERA = "Opera";
-BrowserVersion.IE = "IE";
-BrowserVersion.KONQUEROR = "Konqueror";
-BrowserVersion.SAFARI = "Safari";
-BrowserVersion.FIREFOX = "Firefox";
-BrowserVersion.MOZILLA = "Mozilla";
-BrowserVersion.UNKNOWN = "Unknown";
-
-var browserVersion = new BrowserVersion();
diff --git a/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-commandhandlers.js b/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-commandhandlers.js
deleted file mode 100644
index c893b675..00000000
--- a/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-commandhandlers.js
+++ /dev/null
@@ -1,377 +0,0 @@
-/*
-* Copyright 2004 ThoughtWorks, Inc
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-// A naming convention used in this file:
-//
-//
-// - a "seleniumApi" is an instance of the Selenium object, defined in selenium-api.js.
-//
-// - a "Method" is an unbound function whose target must be supplied when it's called, ie.
-// it should be invoked using Function.call() or Function.apply()
-//
-// - a "Block" is a function that has been bound to a target object, so can be called invoked directly
-// (or with a null target)
-//
-// - "CommandHandler" is effectively an abstract base for
-// various handlers including ActionHandler, AccessorHandler and AssertHandler.
-// Subclasses need to implement an execute(seleniumApi, command) function,
-// where seleniumApi is the Selenium object, and command a SeleniumCommand object.
-//
-// - Handlers will return a "result" object (ActionResult, AccessorResult, AssertResult).
-// ActionResults may contain a .terminationCondition function which is run by
-// -executionloop.js after the command is run; we'll run it over and over again
-// until it returns true or the .terminationCondition throws an exception.
-// AccessorResults will contain the results of running getter (e.g. getTitle returns
-// the title as a string).
-
-var CommandHandlerFactory = classCreate();
-objectExtend(CommandHandlerFactory.prototype, {
-
- initialize: function() {
- this.handlers = {};
- },
-
- registerAction: function(name, actionBlock, wait, dontCheckAlertsAndConfirms) {
- this.handlers[name] = new ActionHandler(actionBlock, wait, dontCheckAlertsAndConfirms);
- },
-
- registerAccessor: function(name, accessBlock) {
- this.handlers[name] = new AccessorHandler(accessBlock);
- },
-
- registerAssert: function(name, assertBlock, haltOnFailure) {
- this.handlers[name] = new AssertHandler(assertBlock, haltOnFailure);
- },
-
- getCommandHandler: function(name) {
- return this.handlers[name];
- },
-
- _registerAllAccessors: function(seleniumApi) {
- // Methods of the form getFoo(target) result in commands:
- // getFoo, assertFoo, verifyFoo, assertNotFoo, verifyNotFoo
- // storeFoo, waitForFoo, and waitForNotFoo.
- for (var functionName in seleniumApi) {
- var match = /^(get|is)([A-Z].+)$/.exec(functionName);
- if (match) {
- var accessMethod = seleniumApi[functionName];
- var accessBlock = fnBind(accessMethod, seleniumApi);
- var baseName = match[2];
- var isBoolean = (match[1] == "is");
- var requiresTarget = (accessMethod.length == 1);
-
- this.registerAccessor(functionName, accessBlock);
- this._registerStoreCommandForAccessor(baseName, accessBlock, requiresTarget);
-
- var predicateBlock = this._predicateForAccessor(accessBlock, requiresTarget, isBoolean);
- this._registerAssertionsForPredicate(baseName, predicateBlock);
- this._registerWaitForCommandsForPredicate(seleniumApi, baseName, predicateBlock);
- }
- }
- },
-
- _registerAllActions: function(seleniumApi) {
- for (var functionName in seleniumApi) {
- var match = /^do([A-Z].+)$/.exec(functionName);
- if (match) {
- var actionName = match[1].lcfirst();
- var actionMethod = seleniumApi[functionName];
- var dontCheckPopups = actionMethod.dontCheckAlertsAndConfirms;
- var actionBlock = fnBind(actionMethod, seleniumApi);
- this.registerAction(actionName, actionBlock, false, dontCheckPopups);
- this.registerAction(actionName + "AndWait", actionBlock, true, dontCheckPopups);
- }
- }
- },
-
- _registerAllAsserts: function(seleniumApi) {
- for (var functionName in seleniumApi) {
- var match = /^assert([A-Z].+)$/.exec(functionName);
- if (match) {
- var assertBlock = fnBind(seleniumApi[functionName], seleniumApi);
-
- // Register the assert with the "assert" prefix, and halt on failure.
- var assertName = functionName;
- this.registerAssert(assertName, assertBlock, true);
-
- // Register the assert with the "verify" prefix, and do not halt on failure.
- var verifyName = "verify" + match[1];
- this.registerAssert(verifyName, assertBlock, false);
- }
- }
- },
-
- registerAll: function(seleniumApi) {
- this._registerAllAccessors(seleniumApi);
- this._registerAllActions(seleniumApi);
- this._registerAllAsserts(seleniumApi);
- },
-
- _predicateForAccessor: function(accessBlock, requiresTarget, isBoolean) {
- if (isBoolean) {
- return this._predicateForBooleanAccessor(accessBlock);
- }
- if (requiresTarget) {
- return this._predicateForSingleArgAccessor(accessBlock);
- }
- return this._predicateForNoArgAccessor(accessBlock);
- },
-
- _predicateForSingleArgAccessor: function(accessBlock) {
- // Given an accessor function getBlah(target),
- // return a "predicate" equivalient to isBlah(target, value) that
- // is true when the value returned by the accessor matches the specified value.
- return function(target, value) {
- var accessorResult = accessBlock(target);
- accessorResult = selArrayToString(accessorResult);
- if (PatternMatcher.matches(value, accessorResult)) {
- return new PredicateResult(true, "Actual value '" + accessorResult + "' did match '" + value + "'");
- } else {
- return new PredicateResult(false, "Actual value '" + accessorResult + "' did not match '" + value + "'");
- }
- };
- },
-
- _predicateForNoArgAccessor: function(accessBlock) {
- // Given a (no-arg) accessor function getBlah(),
- // return a "predicate" equivalient to isBlah(value) that
- // is true when the value returned by the accessor matches the specified value.
- return function(value) {
- var accessorResult = accessBlock();
- accessorResult = selArrayToString(accessorResult);
- if (PatternMatcher.matches(value, accessorResult)) {
- return new PredicateResult(true, "Actual value '" + accessorResult + "' did match '" + value + "'");
- } else {
- return new PredicateResult(false, "Actual value '" + accessorResult + "' did not match '" + value + "'");
- }
- };
- },
-
- _predicateForBooleanAccessor: function(accessBlock) {
- // Given a boolean accessor function isBlah(),
- // return a "predicate" equivalient to isBlah() that
- // returns an appropriate PredicateResult value.
- return function() {
- var accessorResult;
- if (arguments.length > 2) throw new SeleniumError("Too many arguments! " + arguments.length);
- if (arguments.length == 2) {
- accessorResult = accessBlock(arguments[0], arguments[1]);
- } else if (arguments.length == 1) {
- accessorResult = accessBlock(arguments[0]);
- } else {
- accessorResult = accessBlock();
- }
- if (accessorResult) {
- return new PredicateResult(true, "true");
- } else {
- return new PredicateResult(false, "false");
- }
- };
- },
-
- _invertPredicate: function(predicateBlock) {
- // Given a predicate, return the negation of that predicate.
- // Leaves the message unchanged.
- // Used to create assertNot, verifyNot, and waitForNot commands.
- return function(target, value) {
- var result = predicateBlock(target, value);
- result.isTrue = !result.isTrue;
- return result;
- };
- },
-
- createAssertionFromPredicate: function(predicateBlock) {
- // Convert an isBlahBlah(target, value) function into an assertBlahBlah(target, value) function.
- return function(target, value) {
- var result = predicateBlock(target, value);
- if (!result.isTrue) {
- Assert.fail(result.message);
- }
- };
- },
-
- _invertPredicateName: function(baseName) {
- var matchResult = /^(.*)Present$/.exec(baseName);
- if (matchResult != null) {
- return matchResult[1] + "NotPresent";
- }
- return "Not" + baseName;
- },
-
- _registerAssertionsForPredicate: function(baseName, predicateBlock) {
- // Register an assertion, a verification, a negative assertion,
- // and a negative verification based on the specified accessor.
- var assertBlock = this.createAssertionFromPredicate(predicateBlock);
- this.registerAssert("assert" + baseName, assertBlock, true);
- this.registerAssert("verify" + baseName, assertBlock, false);
-
- var invertedPredicateBlock = this._invertPredicate(predicateBlock);
- var negativeassertBlock = this.createAssertionFromPredicate(invertedPredicateBlock);
- this.registerAssert("assert" + this._invertPredicateName(baseName), negativeassertBlock, true);
- this.registerAssert("verify" + this._invertPredicateName(baseName), negativeassertBlock, false);
- },
-
- _waitForActionForPredicate: function(predicateBlock) {
- // Convert an isBlahBlah(target, value) function into a waitForBlahBlah(target, value) function.
- return function(target, value) {
- var terminationCondition = function () {
- try {
- return predicateBlock(target, value).isTrue;
- } catch (e) {
- // Treat exceptions as meaning the condition is not yet met.
- // Useful, for example, for waitForValue when the element has
- // not even been created yet.
- // TODO: possibly should rethrow some types of exception.
- return false;
- }
- };
- return Selenium.decorateFunctionWithTimeout(terminationCondition, this.defaultTimeout);
- };
- },
-
- _registerWaitForCommandsForPredicate: function(seleniumApi, baseName, predicateBlock) {
- // Register a waitForBlahBlah and waitForNotBlahBlah based on the specified accessor.
- var waitForActionMethod = this._waitForActionForPredicate(predicateBlock);
- var waitForActionBlock = fnBind(waitForActionMethod, seleniumApi);
-
- var invertedPredicateBlock = this._invertPredicate(predicateBlock);
- var waitForNotActionMethod = this._waitForActionForPredicate(invertedPredicateBlock);
- var waitForNotActionBlock = fnBind(waitForNotActionMethod, seleniumApi);
-
- this.registerAction("waitFor" + baseName, waitForActionBlock, false, true);
- this.registerAction("waitFor" + this._invertPredicateName(baseName), waitForNotActionBlock, false, true);
- //TODO decide remove "waitForNot.*Present" action name or not
- //for the back compatiblity issues we still make waitForNot.*Present availble
- this.registerAction("waitForNot" + baseName, waitForNotActionBlock, false, true);
- },
-
- _registerStoreCommandForAccessor: function(baseName, accessBlock, requiresTarget) {
- var action;
- if (requiresTarget) {
- action = function(target, varName) {
- storedVars[varName] = accessBlock(target);
- };
- } else {
- action = function(varName) {
- storedVars[varName] = accessBlock();
- };
- }
- this.registerAction("store" + baseName, action, false, true);
- }
-
-});
-
-function PredicateResult(isTrue, message) {
- this.isTrue = isTrue;
- this.message = message;
-}
-
-// NOTE: The CommandHandler is effectively an abstract base for
-// various handlers including ActionHandler, AccessorHandler and AssertHandler.
-// Subclasses need to implement an execute(seleniumApi, command) function,
-// where seleniumApi is the Selenium object, and command a SeleniumCommand object.
-function CommandHandler(type, haltOnFailure) {
- this.type = type;
- this.haltOnFailure = haltOnFailure;
-}
-
-// An ActionHandler is a command handler that executes the sepcified action,
-// possibly checking for alerts and confirmations (if checkAlerts is set), and
-// possibly waiting for a page load if wait is set.
-function ActionHandler(actionBlock, wait, dontCheckAlerts) {
- this.actionBlock = actionBlock;
- CommandHandler.call(this, "action", true);
- if (wait) {
- this.wait = true;
- }
- // note that dontCheckAlerts could be undefined!!!
- this.checkAlerts = (dontCheckAlerts) ? false : true;
-}
-ActionHandler.prototype = new CommandHandler;
-ActionHandler.prototype.execute = function(seleniumApi, command) {
- if (this.checkAlerts && (null == /(Alert|Confirmation)(Not)?Present/.exec(command.command))) {
- // todo: this conditional logic is ugly
- seleniumApi.ensureNoUnhandledPopups();
- }
- var terminationCondition = this.actionBlock(command.target, command.value);
- // If the handler didn't return a wait flag, check to see if the
- // handler was registered with the wait flag.
- if (terminationCondition == undefined && this.wait) {
- terminationCondition = seleniumApi.makePageLoadCondition();
- }
- return new ActionResult(terminationCondition);
-};
-
-function ActionResult(terminationCondition) {
- this.terminationCondition = terminationCondition;
-}
-
-function AccessorHandler(accessBlock) {
- this.accessBlock = accessBlock;
- CommandHandler.call(this, "accessor", true);
-}
-AccessorHandler.prototype = new CommandHandler;
-AccessorHandler.prototype.execute = function(seleniumApi, command) {
- var returnValue = this.accessBlock(command.target, command.value);
- return new AccessorResult(returnValue);
-};
-
-function AccessorResult(result) {
- this.result = result;
-}
-
-/**
- * Handler for assertions and verifications.
- */
-function AssertHandler(assertBlock, haltOnFailure) {
- this.assertBlock = assertBlock;
- CommandHandler.call(this, "assert", haltOnFailure || false);
-}
-AssertHandler.prototype = new CommandHandler;
-AssertHandler.prototype.execute = function(seleniumApi, command) {
- var result = new AssertResult();
- try {
- this.assertBlock(command.target, command.value);
- } catch (e) {
- // If this is not a AssertionFailedError, or we should haltOnFailure, rethrow.
- if (!e.isAssertionFailedError) {
- throw e;
- }
- if (this.haltOnFailure) {
- var error = new SeleniumError(e.failureMessage);
- throw error;
- }
- result.setFailed(e.failureMessage);
- }
- return result;
-};
-
-function AssertResult() {
- this.passed = true;
-}
-AssertResult.prototype.setFailed = function(message) {
- this.passed = null;
- this.failed = true;
- this.failureMessage = message;
-}
-
-function SeleniumCommand(command, target, value, isBreakpoint) {
- this.command = command;
- this.target = target;
- this.value = value;
- this.isBreakpoint = isBreakpoint;
-}
-
diff --git a/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-executionloop.js b/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-executionloop.js
deleted file mode 100644
index 39fa2421..00000000
--- a/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-executionloop.js
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
-* Copyright 2004 ThoughtWorks, Inc
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-function TestLoop(commandFactory) {
- this.commandFactory = commandFactory;
-}
-
-TestLoop.prototype = {
-
- start : function() {
- selenium.reset();
- LOG.debug("currentTest.start()");
- this.continueTest();
- },
-
- continueTest : function() {
- /**
- * Select the next command and continue the test.
- */
- LOG.debug("currentTest.continueTest() - acquire the next command");
- if (! this.aborted) {
- this.currentCommand = this.nextCommand();
- }
- if (! this.requiresCallBack) {
- this.continueTestAtCurrentCommand();
- } // otherwise, just finish and let the callback invoke continueTestAtCurrentCommand()
- },
-
- continueTestAtCurrentCommand : function() {
- LOG.debug("currentTest.continueTestAtCurrentCommand()");
- if (this.currentCommand) {
- // TODO: rename commandStarted to commandSelected, OR roll it into nextCommand
- this.commandStarted(this.currentCommand);
- this._resumeAfterDelay();
- } else {
- this._testComplete();
- }
- },
-
- _resumeAfterDelay : function() {
- /**
- * Pause, then execute the current command.
- */
-
- // Get the command delay. If a pauseInterval is set, use it once
- // and reset it. Otherwise, use the defined command-interval.
- var delay = this.pauseInterval || this.getCommandInterval();
- this.pauseInterval = undefined;
-
- if (this.currentCommand.isBreakpoint || delay < 0) {
- // Pause: enable the "next/continue" button
- this.pause();
- } else {
- window.setTimeout(fnBind(this.resume, this), delay);
- }
- },
-
- resume: function() {
- /**
- * Select the next command and continue the test.
- */
- LOG.debug("currentTest.resume() - actually execute");
- try {
- selenium.browserbot.runScheduledPollers();
- this._executeCurrentCommand();
- this.continueTestWhenConditionIsTrue();
- } catch (e) {
- if (!this._handleCommandError(e)) {
- this.testComplete();
- } else {
- this.continueTest();
- }
- }
- },
-
- _testComplete : function() {
- selenium.ensureNoUnhandledPopups();
- this.testComplete();
- },
-
- _executeCurrentCommand : function() {
- /**
- * Execute the current command.
- *
- * @return a function which will be used to determine when
- * execution can continue, or null if we can continue immediately
- */
- var command = this.currentCommand;
- LOG.info("Executing: |" + command.command + " | " + command.target + " | " + command.value + " |");
-
- var handler = this.commandFactory.getCommandHandler(command.command);
- if (handler == null) {
- throw new SeleniumError("Unknown command: '" + command.command + "'");
- }
-
- command.target = selenium.preprocessParameter(command.target);
- command.value = selenium.preprocessParameter(command.value);
- LOG.debug("Command found, going to execute " + command.command);
- this.result = handler.execute(selenium, command);
-
-
- this.waitForCondition = this.result.terminationCondition;
-
- },
-
- _handleCommandError : function(e) {
- if (!e.isSeleniumError) {
- LOG.exception(e);
- var msg = "Command execution failure. Please search the forum at http://clearspace.openqa.org for error details from the log window.";
- msg += " The error message is: " + extractExceptionMessage(e);
- return this.commandError(msg);
- } else {
- LOG.error(e.message);
- return this.commandError(e.message);
- }
- },
-
- continueTestWhenConditionIsTrue: function () {
- /**
- * Busy wait for waitForCondition() to become true, and then carry
- * on with test. Fail the current test if there's a timeout or an
- * exception.
- */
- //LOG.debug("currentTest.continueTestWhenConditionIsTrue()");
- selenium.browserbot.runScheduledPollers();
- try {
- if (this.waitForCondition == null) {
- LOG.debug("null condition; let's continueTest()");
- LOG.debug("Command complete");
- this.commandComplete(this.result);
- this.continueTest();
- } else if (this.waitForCondition()) {
- LOG.debug("condition satisfied; let's continueTest()");
- this.waitForCondition = null;
- LOG.debug("Command complete");
- this.commandComplete(this.result);
- this.continueTest();
- } else {
- //LOG.debug("waitForCondition was false; keep waiting!");
- window.setTimeout(fnBind(this.continueTestWhenConditionIsTrue, this), 10);
- }
- } catch (e) {
- this.result = {};
- this.result.failed = true;
- this.result.failureMessage = extractExceptionMessage(e);
- this.commandComplete(this.result);
- this.continueTest();
- }
- },
-
- pause : function() {},
- nextCommand : function() {},
- commandStarted : function() {},
- commandComplete : function() {},
- commandError : function() {},
- testComplete : function() {},
-
- getCommandInterval : function() {
- return 0;
- }
-
-}
diff --git a/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-logging.js b/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-logging.js
deleted file mode 100644
index eac9d2a7..00000000
--- a/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-logging.js
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright 2004 ThoughtWorks, Inc
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-var Logger = function() {
- this.logWindow = null;
-}
-Logger.prototype = {
-
- logLevels: {
- debug: 0,
- info: 1,
- warn: 2,
- error: 3,
- off: 999
- },
-
- pendingMessages: new Array(),
-
- threshold: "info",
-
- setLogLevelThreshold: function(logLevel) {
- this.threshold = logLevel;
- var logWindow = this.getLogWindow()
- if (logWindow && logWindow.setThresholdLevel) {
- logWindow.setThresholdLevel(logLevel);
- }
- // NOTE: log messages will be discarded until the log window is
- // fully loaded.
- },
-
- getLogWindow: function() {
- if (this.logWindow && this.logWindow.closed) {
- this.logWindow = null;
- }
- return this.logWindow;
- },
-
- openLogWindow: function() {
- this.logWindow = window.open(
- getDocumentBase(document) + "SeleniumLog.html?startingThreshold="+this.threshold, "SeleniumLog",
- "width=600,height=1000,bottom=0,right=0,status,scrollbars,resizable"
- );
- this.logWindow.moveTo(window.screenX + 1210, window.screenY + window.outerHeight - 1400);
- if (browserVersion.appearsToBeBrokenInitialIE6) {
- // I would really prefer for the message to immediately appear in the log window, the instant the user requests that the log window be
- // visible. But when I initially coded it this way, thou message simply didn't appear unless I stepped through the code with a debugger.
- // So obviously there is some timing issue here which I don't have the patience to figure out.
- var pendingMessage = new LogMessage("warn", "You appear to be running an unpatched IE 6, which is not stable and can crash due to memory problems. We recommend you run Windows update to install a more stable version of IE.");
- this.pendingMessages.push(pendingMessage);
- }
- return this.logWindow;
- },
-
- show: function() {
- if (! this.getLogWindow()) {
- this.openLogWindow();
- }
- setTimeout(function(){LOG.error("Log window displayed. Logging events will now be recorded to this window.");}, 500);
- },
-
- logHook: function(logLevel, message) {
- },
-
- log: function(logLevel, message) {
- if (this.logLevels[logLevel] < this.logLevels[this.threshold]) {
- return;
- }
- this.logHook(logLevel, message);
- var logWindow = this.getLogWindow();
- if (logWindow) {
- if (logWindow.append) {
- if (logWindow.disabled) {
- logWindow.callBack = fnBind(this.setLogLevelThreshold, this);
- logWindow.enableButtons();
- }
- if (this.pendingMessages.length > 0) {
- logWindow.append("info("+(new Date().getTime())+"): Appending missed logging messages", "info");
- while (this.pendingMessages.length > 0) {
- var msg = this.pendingMessages.shift();
- logWindow.append(msg.type + "("+msg.timestamp+"): " + msg.msg, msg.type);
- }
- logWindow.append("info("+(new Date().getTime())+"): Done appending missed logging messages", "info");
- }
- logWindow.append(logLevel + "("+(new Date().getTime())+"): " + message, logLevel);
- }
- } else {
- // TODO these logging messages are never flushed, which creates
- // an enormous array of strings that never stops growing.
- // there should at least be a way to clear the messages!
- this.pendingMessages.push(new LogMessage(logLevel, message));
- }
- },
-
- close: function(message) {
- if (this.logWindow != null) {
- try {
- this.logWindow.close();
- } catch (e) {
- // swallow exception
- // the window is probably closed if we get an exception here
- }
- this.logWindow = null;
- }
- },
-
- debug: function(message) {
- this.log("debug", message);
- },
-
- info: function(message) {
- this.log("info", message);
- },
-
- warn: function(message) {
- this.log("warn", message);
- },
-
- error: function(message) {
- this.log("error", message);
- },
-
- exception: function(exception) {
- this.error("Unexpected Exception: " + extractExceptionMessage(exception));
- this.error("Exception details: " + describe(exception, ', '));
- }
-
-};
-
-var LOG = new Logger();
-
-var LogMessage = function(type, msg) {
- this.type = type;
- this.msg = msg;
- this.timestamp = (new Date().getTime());
-}
diff --git a/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-remoterunner.js b/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-remoterunner.js
deleted file mode 100644
index 70ed3282..00000000
--- a/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-remoterunner.js
+++ /dev/null
@@ -1,695 +0,0 @@
-/*
-* Copyright 2005 ThoughtWorks, Inc
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*
-*/
-
-passColor = "#cfffcf";
-failColor = "#ffcfcf";
-errorColor = "#ffffff";
-workingColor = "#DEE7EC";
-doneColor = "#FFFFCC";
-
-var injectedSessionId;
-
-var postResult = "START";
-var debugMode = false;
-var relayToRC = null;
-var proxyInjectionMode = false;
-var uniqueId = 'sel_' + Math.round(100000 * Math.random());
-var seleniumSequenceNumber = 0;
-var cmd8 = "";
-var cmd7 = "";
-var cmd6 = "";
-var cmd5 = "";
-var cmd4 = "";
-var cmd3 = "";
-var cmd2 = "";
-var cmd1 = "";
-var lastCmd = "";
-var lastCmdTime = new Date();
-
-var RemoteRunnerOptions = classCreate();
-objectExtend(RemoteRunnerOptions.prototype, URLConfiguration.prototype);
-objectExtend(RemoteRunnerOptions.prototype, {
- initialize: function() {
- this._acquireQueryString();
- },
- isDebugMode: function() {
- return this._isQueryParameterTrue("debugMode");
- },
-
- getContinue: function() {
- return this._getQueryParameter("continue");
- },
-
- getDriverUrl: function() {
- return this._getQueryParameter("driverUrl");
- },
-
- // requires per-session extension Javascript as soon as this Selenium
- // instance becomes aware of the session identifier
- getSessionId: function() {
- var sessionId = this._getQueryParameter("sessionId");
- requireExtensionJs(sessionId);
- return sessionId;
- },
-
- _acquireQueryString: function () {
- if (this.queryString) return;
- if (browserVersion.isHTA) {
- var args = this._extractArgs();
- if (args.length < 2) return null;
- this.queryString = args[1];
- } else if (proxyInjectionMode) {
- this.queryString = window.location.search.substr(1);
- } else {
- this.queryString = top.location.search.substr(1);
- }
- }
-
-});
-var runOptions;
-
-function runSeleniumTest() {
- runOptions = new RemoteRunnerOptions();
- var testAppWindow;
-
- if (runOptions.isMultiWindowMode()) {
- testAppWindow = openSeparateApplicationWindow('Blank.html', true);
- } else if (sel$('selenium_myiframe') != null) {
- var myiframe = sel$('selenium_myiframe');
- if (myiframe) {
- testAppWindow = myiframe.contentWindow;
- }
- }
- else {
- proxyInjectionMode = true;
- testAppWindow = window;
- }
- selenium = Selenium.createForWindow(testAppWindow, proxyInjectionMode);
- if (runOptions.getBaseUrl()) {
- selenium.browserbot.baseUrl = runOptions.getBaseUrl();
- }
- if (!debugMode) {
- debugMode = runOptions.isDebugMode();
- }
- if (proxyInjectionMode) {
- LOG.logHook = logToRc;
- selenium.browserbot._modifyWindow(testAppWindow);
- }
- else if (debugMode) {
- LOG.logHook = logToRc;
- }
- window.selenium = selenium;
-
- commandFactory = new CommandHandlerFactory();
- commandFactory.registerAll(selenium);
-
- currentTest = new RemoteRunner(commandFactory);
-
- var doContinue = runOptions.getContinue();
- if (doContinue != null) postResult = "OK";
-
- currentTest.start();
-}
-
-function buildDriverUrl() {
- var driverUrl = runOptions.getDriverUrl();
- if (driverUrl != null) {
- return driverUrl;
- }
- var s = window.location.href
- var slashPairOffset = s.indexOf("//") + "//".length
- var pathSlashOffset = s.substring(slashPairOffset).indexOf("/")
- return s.substring(0, slashPairOffset + pathSlashOffset) + "/selenium-server/driver/";
- //return "http://localhost" + uniqueId + "/selenium-server/driver/";
-}
-
-function logToRc(logLevel, message) {
- if (debugMode) {
- if (logLevel == null) {
- logLevel = "debug";
- }
- sendToRCAndForget("logLevel=" + logLevel + ":" + message.replace(/[\n\r\015]/g, " ") + "\n", "logging=true");
- }
-}
-
-function serializeString(name, s) {
- return name + "=unescape(\"" + escape(s) + "\");";
-}
-
-function serializeObject(name, x)
-{
- var s = '';
-
- if (isArray(x))
- {
- s = name + "=new Array(); ";
- var len = x["length"];
- for (var j = 0; j < len; j++)
- {
- s += serializeString(name + "[" + j + "]", x[j]);
- }
- }
- else if (typeof x == "string")
- {
- s = serializeString(name, x);
- }
- else
- {
- throw "unrecognized object not encoded: " + name + "(" + x + ")";
- }
- return s;
-}
-
-function relayBotToRC(s) {
-}
-
-// seems like no one uses this, but in fact it is called using eval from server-side PI mode code; however,
-// because multiple names can map to the same popup, assigning a single name confuses matters sometimes;
-// thus, I'm disabling this for now. -Nelson 10/21/06
-function setSeleniumWindowName(seleniumWindowName) {
-//selenium.browserbot.getCurrentWindow()['seleniumWindowName'] = seleniumWindowName;
-}
-
-RemoteRunner = classCreate();
-objectExtend(RemoteRunner.prototype, new TestLoop());
-objectExtend(RemoteRunner.prototype, {
- initialize : function(commandFactory) {
- this.commandFactory = commandFactory;
- this.requiresCallBack = true;
- this.commandNode = null;
- this.xmlHttpForCommandsAndResults = null;
- },
-
- nextCommand : function() {
- var urlParms = "";
- if (postResult == "START") {
- urlParms += "seleniumStart=true";
- }
- this.xmlHttpForCommandsAndResults = XmlHttp.create();
- sendToRC(postResult, urlParms, fnBind(this._HandleHttpResponse, this), this.xmlHttpForCommandsAndResults);
- },
-
- commandStarted : function(command) {
- this.commandNode = document.createElement("div");
- var cmdText = command.command + '(';
- if (command.target != null && command.target != "") {
- cmdText += command.target;
- if (command.value != null && command.value != "") {
- cmdText += ', ' + command.value;
- }
- }
- if (cmdText.length > 70) {
- cmdText = cmdText.substring(0, 70) + "...\n";
- } else {
- cmdText += ")\n";
- }
-
- if (cmdText == lastCmd) {
- var rightNow = new Date();
- var msSinceStart = rightNow.getTime() - lastCmdTime.getTime();
- var sinceStart = msSinceStart + "ms";
- if (msSinceStart > 1000) {
- sinceStart = Math.round(msSinceStart / 1000) + "s";
- }
- cmd1 = "Same command (" + sinceStart + "): " + lastCmd;
- } else {
- lastCmdTime = new Date();
- cmd8 = cmd7;
- cmd7 = cmd6;
- cmd6 = cmd5;
- cmd5 = cmd4;
- cmd4 = cmd3;
- cmd3 = cmd2;
- cmd2 = cmd1;
- cmd1 = cmdText;
- }
- lastCmd = cmdText;
-
- if (! proxyInjectionMode) {
- var commandList = document.commands.commandList;
- commandList.value = cmd8 + cmd7 + cmd6 + cmd5 + cmd4 + cmd3 + cmd2 + cmd1;
- commandList.scrollTop = commandList.scrollHeight;
- }
- },
-
- commandComplete : function(result) {
-
- if (result.failed) {
- if (postResult == "CONTINUATION") {
- currentTest.aborted = true;
- }
- postResult = result.failureMessage;
- this.commandNode.title = result.failureMessage;
- this.commandNode.style.backgroundColor = failColor;
- } else if (result.passed) {
- postResult = "OK";
- this.commandNode.style.backgroundColor = passColor;
- } else {
- if (result.result == null) {
- postResult = "OK";
- } else {
- var actualResult = result.result;
- actualResult = selArrayToString(actualResult);
- postResult = "OK," + actualResult;
- }
- this.commandNode.style.backgroundColor = doneColor;
- }
- },
-
- commandError : function(message) {
- postResult = "ERROR: " + message;
- this.commandNode.style.backgroundColor = errorColor;
- this.commandNode.titcle = message;
- },
-
- testComplete : function() {
- window.status = "Selenium Tests Complete, for this Test"
- // Continue checking for new results
- this.continueTest();
- postResult = "START";
- },
-
- _HandleHttpResponse : function() {
- // When request is completed
- if (this.xmlHttpForCommandsAndResults.readyState == 4) {
- // OK
- if (this.xmlHttpForCommandsAndResults.status == 200) {
- if (this.xmlHttpForCommandsAndResults.responseText=="") {
- LOG.error("saw blank string xmlHttpForCommandsAndResults.responseText");
- return;
- }
- var command = this._extractCommand(this.xmlHttpForCommandsAndResults);
- if (command.command == 'retryLast') {
- setTimeout(fnBind(function() {
- sendToRC("RETRY", "retry=true", fnBind(this._HandleHttpResponse, this), this.xmlHttpForCommandsAndResults, true);
- }, this), 1000);
- } else {
- this.currentCommand = command;
- this.continueTestAtCurrentCommand();
- }
- }
- // Not OK
- else {
- var s = 'xmlHttp returned: ' + this.xmlHttpForCommandsAndResults.status + ": " + this.xmlHttpForCommandsAndResults.statusText;
- LOG.error(s);
- this.currentCommand = null;
- setTimeout(fnBind(this.continueTestAtCurrentCommand, this), 2000);
- }
-
- }
- },
-
- _extractCommand : function(xmlHttp) {
- var command, text, json;
- text = command = xmlHttp.responseText;
- if (/^json=/.test(text)) {
- eval(text);
- if (json.rest) {
- eval(json.rest);
- }
- return json;
- }
- try {
- var re = new RegExp("^(.*?)\n((.|[\r\n])*)");
- if (re.exec(xmlHttp.responseText)) {
- command = RegExp.$1;
- var rest = RegExp.$2;
- rest = rest.trim();
- if (rest) {
- eval(rest);
- }
- }
- else {
- command = xmlHttp.responseText;
- }
- } catch (e) {
- alert('could not get responseText: ' + e.message);
- }
- if (command.substr(0, '|testComplete'.length) == '|testComplete') {
- return null;
- }
-
- return this._createCommandFromRequest(command);
- },
-
-
- _delay : function(millis) {
- var startMillis = new Date();
- while (true) {
- milli = new Date();
- if (milli - startMillis > millis) {
- break;
- }
- }
- },
-
-// Parses a URI query string into a SeleniumCommand object
- _createCommandFromRequest : function(commandRequest) {
- //decodeURIComponent doesn't strip plus signs
- var processed = commandRequest.replace(/\+/g, "%20");
- // strip trailing spaces
- var processed = processed.replace(/\s+$/, "");
- var vars = processed.split("&");
- var cmdArgs = new Object();
- for (var i = 0; i < vars.length; i++) {
- var pair = vars[i].split("=");
- cmdArgs[pair[0]] = pair[1];
- }
- var cmd = cmdArgs['cmd'];
- var arg1 = cmdArgs['1'];
- if (null == arg1) arg1 = "";
- arg1 = decodeURIComponent(arg1);
- var arg2 = cmdArgs['2'];
- if (null == arg2) arg2 = "";
- arg2 = decodeURIComponent(arg2);
- if (cmd == null) {
- throw new Error("Bad command request: " + commandRequest);
- }
- return new SeleniumCommand(cmd, arg1, arg2);
- }
-
-})
-
-
-function sendToRC(dataToBePosted, urlParms, callback, xmlHttpObject, async) {
- if (async == null) {
- async = true;
- }
- if (xmlHttpObject == null) {
- xmlHttpObject = XmlHttp.create();
- }
- var url = buildDriverUrl() + "?"
- if (urlParms) {
- url += urlParms;
- }
- url = addUrlParams(url);
- url += "&sequenceNumber=" + seleniumSequenceNumber++;
-
- var postedData = "postedData=" + encodeURIComponent(dataToBePosted);
-
- //xmlHttpObject.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
- xmlHttpObject.open("POST", url, async);
- if (callback) xmlHttpObject.onreadystatechange = callback;
- xmlHttpObject.send(postedData);
- return null;
-}
-
-function addUrlParams(url) {
- return url + "&localFrameAddress=" + (proxyInjectionMode ? makeAddressToAUTFrame() : "top")
- + getSeleniumWindowNameURLparameters()
- + "&uniqueId=" + uniqueId
- + buildDriverParams() + preventBrowserCaching()
-}
-
-function sendToRCAndForget(dataToBePosted, urlParams) {
- var url;
- if (!(browserVersion.isChrome || browserVersion.isHTA)) {
- // DGF we're behind a proxy, so we can send our logging message to literally any host, to avoid 2-connection limit
- var protocol = "http:";
- if (window.location.protocol == "https:") {
- // DGF if we're in HTTPS, use another HTTPS url to avoid security warning
- protocol = "https:";
- }
- // we don't choose a super large random value, but rather 1 - 16, because this matches with the pre-computed
- // tunnels waiting on the Selenium Server side. This gives us higher throughput than the two-connection-per-host
- // limitation, but doesn't require we generate an extremely large ammount of fake SSL certs either.
- url = protocol + "//" + Math.floor(Math.random()* 16 + 1) + ".selenium.doesnotexist/selenium-server/driver/?" + urlParams;
- } else {
- url = buildDriverUrl() + "?" + urlParams;
- }
- url = addUrlParams(url);
-
- var method = "GET";
- if (method == "POST") {
- // DGF submit a request using an iframe; we can't see the response, but we don't need to
- // TODO not using this mechanism because it screws up back-button
- var loggingForm = document.createElement("form");
- loggingForm.method = "POST";
- loggingForm.action = url;
- loggingForm.target = "seleniumLoggingFrame";
- var postedDataInput = document.createElement("input");
- postedDataInput.type = "hidden";
- postedDataInput.name = "postedData";
- postedDataInput.value = dataToBePosted;
- loggingForm.appendChild(postedDataInput);
- document.body.appendChild(loggingForm);
- loggingForm.submit();
- document.body.removeChild(loggingForm);
- } else {
- var postedData = "&postedData=" + encodeURIComponent(dataToBePosted);
- var scriptTag = document.createElement("script");
- scriptTag.src = url + postedData;
- document.body.appendChild(scriptTag);
- document.body.removeChild(scriptTag);
- }
-}
-
-function buildDriverParams() {
- var params = "";
-
- var sessionId = runOptions.getSessionId();
- if (sessionId == undefined) {
- sessionId = injectedSessionId;
- }
- if (sessionId != undefined) {
- params = params + "&sessionId=" + sessionId;
- }
- return params;
-}
-
-function preventBrowserCaching() {
- var t = (new Date()).getTime();
- return "&counterToMakeURsUniqueAndSoStopPageCachingInTheBrowser=" + t;
-}
-
-//
-// Return URL parameters pertaining to the name(s?) of the current window
-//
-// In selenium, the main (i.e., first) window's name is a blank string.
-//
-// Additional pop-ups are associated with either 1.) the name given by the 2nd parameter to window.open, or 2.) the name of a
-// property on the opening window which points at the window.
-//
-// An example of #2: if window X contains JavaScript as follows:
-//
-// var windowABC = window.open(...)
-//
-// Note that the example JavaScript above is equivalent to
-//
-// window["windowABC"] = window.open(...)
-//
-function getSeleniumWindowNameURLparameters() {
- var w = (proxyInjectionMode ? selenium.browserbot.getCurrentWindow() : window).top;
- var s = "&seleniumWindowName=";
- if (w.opener == null) {
- return s;
- }
- if (w["seleniumWindowName"] == null) {
- if (w.name) {
- w["seleniumWindowName"] = w.name;
- } else {
- w["seleniumWindowName"] = 'generatedSeleniumWindowName_' + Math.round(100000 * Math.random());
- }
- }
- s += w["seleniumWindowName"];
- var windowOpener = w.opener;
- for (key in windowOpener) {
- var val = null;
- try {
- val = windowOpener[key];
- }
- catch(e) {
- }
- if (val==w) {
- s += "&jsWindowNameVar=" + key; // found a js variable in the opener referring to this window
- }
- }
- return s;
-}
-
-// construct a JavaScript expression which leads to my frame (i.e., the frame containing the window
-// in which this code is operating)
-function makeAddressToAUTFrame(w, frameNavigationalJSexpression)
-{
- if (w == null)
- {
- w = top;
- frameNavigationalJSexpression = "top";
- }
-
- if (w == selenium.browserbot.getCurrentWindow())
- {
- return frameNavigationalJSexpression;
- }
- for (var j = 0; j < w.frames.length; j++)
- {
- var t = makeAddressToAUTFrame(w.frames[j], frameNavigationalJSexpression + ".frames[" + j + "]");
- if (t != null)
- {
- return t;
- }
- }
- return null;
-}
-
-Selenium.prototype.doSetContext = function(context) {
- /**
- * Writes a message to the status bar and adds a note to the browser-side
- * log.
- *
- * @param context
- * the message to be sent to the browser
- */
- //set the current test title
- var ctx = document.getElementById("context");
- if (ctx != null) {
- ctx.innerHTML = context;
- }
-};
-
-/**
- * Adds a script tag referencing a specially-named user extensions "file". The
- * resource handler for this special file (which won't actually exist) will use
- * the session ID embedded in its name to retrieve per-session specified user
- * extension javascript.
- *
- * @param sessionId
- */
-function requireExtensionJs(sessionId) {
- var src = 'scripts/user-extensions.js[' + sessionId + ']';
- if (document.getElementById(src) == null) {
- var scriptTag = document.createElement('script');
- scriptTag.language = 'JavaScript';
- scriptTag.type = 'text/javascript';
- scriptTag.src = src;
- scriptTag.id = src;
- var headTag = document.getElementsByTagName('head')[0];
- headTag.appendChild(scriptTag);
- }
-}
-
-Selenium.prototype.doAttachFile = function(fieldLocator,fileLocator) {
- /**
- * Sets a file input (upload) field to the file listed in fileLocator
- *
- * @param fieldLocator an element locator
- * @param fileLocator a URL pointing to the specified file. Before the file
- * can be set in the input field (fieldLocator), Selenium RC may need to transfer the file
- * to the local machine before attaching the file in a web page form. This is common in selenium
- * grid configurations where the RC server driving the browser is not the same
- * machine that started the test.
- *
- * Supported Browsers: Firefox ("*chrome") only.
- *
- */
- // This doesn't really do anything on the JS side; we let the Selenium Server take care of this for us!
-};
-
-Selenium.prototype.doCaptureScreenshot = function(filename) {
- /**
- * Captures a PNG screenshot to the specified file.
- *
- * @param filename the absolute path to the file to be written, e.g. "c:\blah\screenshot.png"
- */
- // This doesn't really do anything on the JS side; we let the Selenium Server take care of this for us!
-};
-
-Selenium.prototype.doCaptureScreenshotToString = function() {
- /**
- * Capture a PNG screenshot. It then returns the file as a base 64 encoded string.
- *
- * @return string The base 64 encoded string of the screen shot (PNG file)
- */
- // This doesn't really do anything on the JS side; we let the Selenium Server take care of this for us!
-};
-
-Selenium.prototype.doCaptureEntirePageScreenshotToString = function(kwargs) {
- /**
- * Downloads a screenshot of the browser current window canvas to a
- * based 64 encoded PNG file. The entire windows canvas is captured,
- * including parts rendered outside of the current view port.
- *
- * Currently this only works in Mozilla and when running in chrome mode.
- *
- * @param kwargs A kwargs string that modifies the way the screenshot is captured. Example: "background=#CCFFDD". This may be useful to set for capturing screenshots of less-than-ideal layouts, for example where absolute positioning causes the calculation of the canvas dimension to fail and a black background is exposed (possibly obscuring black text).
- *
- * @return string The base 64 encoded string of the page screenshot (PNG file)
- */
- // This doesn't really do anything on the JS side; we let the Selenium Server take care of this for us!
-};
-
-Selenium.prototype.doShutDownSeleniumServer = function(keycode) {
- /**
- * Kills the running Selenium Server and all browser sessions. After you run this command, you will no longer be able to send
- * commands to the server; you can't remotely start the server once it has been stopped. Normally
- * you should prefer to run the "stop" command, which terminates the current browser session, rather than
- * shutting down the entire server.
- *
- */
- // This doesn't really do anything on the JS side; we let the Selenium Server take care of this for us!
-};
-
-Selenium.prototype.doRetrieveLastRemoteControlLogs = function() {
- /**
- * Retrieve the last messages logged on a specific remote control. Useful for error reports, especially
- * when running multiple remote controls in a distributed environment. The maximum number of log messages
- * that can be retrieve is configured on remote control startup.
- *
- * @return string The last N log messages as a multi-line string.
- */
- // This doesn't really do anything on the JS side; we let the Selenium Server take care of this for us!
-};
-
-Selenium.prototype.doKeyDownNative = function(keycode) {
- /**
- * Simulates a user pressing a key (without releasing it yet) by sending a native operating system keystroke.
- * This function uses the java.awt.Robot class to send a keystroke; this more accurately simulates typing
- * a key on the keyboard. It does not honor settings from the shiftKeyDown, controlKeyDown, altKeyDown and
- * metaKeyDown commands, and does not target any particular HTML element. To send a keystroke to a particular
- * element, focus on the element first before running this command.
- *
- * @param keycode an integer keycode number corresponding to a java.awt.event.KeyEvent; note that Java keycodes are NOT the same thing as JavaScript keycodes!
- */
- // This doesn't really do anything on the JS side; we let the Selenium Server take care of this for us!
-};
-
-Selenium.prototype.doKeyUpNative = function(keycode) {
- /**
- * Simulates a user releasing a key by sending a native operating system keystroke.
- * This function uses the java.awt.Robot class to send a keystroke; this more accurately simulates typing
- * a key on the keyboard. It does not honor settings from the shiftKeyDown, controlKeyDown, altKeyDown and
- * metaKeyDown commands, and does not target any particular HTML element. To send a keystroke to a particular
- * element, focus on the element first before running this command.
- *
- * @param keycode an integer keycode number corresponding to a java.awt.event.KeyEvent; note that Java keycodes are NOT the same thing as JavaScript keycodes!
- */
- // This doesn't really do anything on the JS side; we let the Selenium Server take care of this for us!
-};
-
-Selenium.prototype.doKeyPressNative = function(keycode) {
- /**
- * Simulates a user pressing and releasing a key by sending a native operating system keystroke.
- * This function uses the java.awt.Robot class to send a keystroke; this more accurately simulates typing
- * a key on the keyboard. It does not honor settings from the shiftKeyDown, controlKeyDown, altKeyDown and
- * metaKeyDown commands, and does not target any particular HTML element. To send a keystroke to a particular
- * element, focus on the element first before running this command.
- *
- * @param keycode an integer keycode number corresponding to a java.awt.event.KeyEvent; note that Java keycodes are NOT the same thing as JavaScript keycodes!
- */
- // This doesn't really do anything on the JS side; we let the Selenium Server take care of this for us!
-};
-
diff --git a/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-testrunner.js b/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-testrunner.js
deleted file mode 100644
index efb488f7..00000000
--- a/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-testrunner.js
+++ /dev/null
@@ -1,1362 +0,0 @@
-/*
-* Copyright 2004 ThoughtWorks, Inc
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*
-*/
-
-// An object representing the current test, used external
-var currentTest = null; // TODO: get rid of this global, which mirrors the htmlTestRunner.currentTest
-var selenium = null;
-
-var htmlTestRunner;
-var HtmlTestRunner = classCreate();
-objectExtend(HtmlTestRunner.prototype, {
- initialize: function() {
- this.metrics = new Metrics();
- this.controlPanel = new HtmlTestRunnerControlPanel();
- this.testFailed = false;
- this.currentTest = null;
- this.runAllTests = false;
- this.appWindow = null;
- // we use a timeout here to make sure the LOG has loaded first, so we can see _every_ error
- setTimeout(fnBind(function() {
- this.loadSuiteFrame();
- }, this), 500);
- },
-
- getTestSuite: function() {
- return suiteFrame.getCurrentTestSuite();
- },
-
- markFailed: function() {
- this.testFailed = true;
- this.getTestSuite().markFailed();
- },
-
- loadSuiteFrame: function() {
- var logLevel = this.controlPanel.getDefaultLogLevel();
- if (logLevel) {
- LOG.setLogLevelThreshold(logLevel);
- }
- if (selenium == null) {
- var appWindow = this._getApplicationWindow();
- try { appWindow.location; }
- catch (e) {
- // when reloading, we may be pointing at an old window (Perm Denied)
- setTimeout(fnBind(function() {
- this.loadSuiteFrame();
- }, this), 50);
- return;
- }
- selenium = Selenium.createForWindow(appWindow);
- this._registerCommandHandlers();
- }
- this.controlPanel.setHighlightOption();
- var testSuiteName = this.controlPanel.getTestSuiteName();
- var self = this;
- if (testSuiteName) {
- suiteFrame.load(testSuiteName, function() {setTimeout(fnBind(self._onloadTestSuite, self), 50)} );
- selenium.browserbot.baseUrl = absolutify(testSuiteName, window.location.href);
- }
- // DGF or should we use the old default?
- // selenium.browserbot.baseUrl = window.location.href;
- if (this.controlPanel.getBaseUrl()) {
- selenium.browserbot.baseUrl = this.controlPanel.getBaseUrl();
- }
- },
-
- _getApplicationWindow: function () {
- if (this.controlPanel.isMultiWindowMode()) {
- return this._getSeparateApplicationWindow();
- }
- return sel$('selenium_myiframe').contentWindow;
- },
-
- _getSeparateApplicationWindow: function () {
- if (this.appWindow == null) {
- this.appWindow = openSeparateApplicationWindow('TestRunner-splash.html', this.controlPanel.isAutomatedRun());
- }
- return this.appWindow;
- },
-
- _onloadTestSuite:function () {
- suiteFrame = new HtmlTestSuiteFrame(getSuiteFrame());
- if (! this.getTestSuite().isAvailable()) {
- return;
- }
- if (this.controlPanel.isAutomatedRun()) {
- this.startTestSuite();
- } else if (this.controlPanel.getAutoUrl()) {
- //todo what is the autourl doing, left to check it out
- addLoadListener(this._getApplicationWindow(), fnBind(this._startSingleTest, this));
- this._getApplicationWindow().src = this.controlPanel.getAutoUrl();
- } else {
- var testCaseLoaded = fnBind(function(){this.testCaseLoaded=true;},this);
- var testNumber = 0;
- if (this.controlPanel.getTestNumber() != null){
- var testNumber = this.controlPanel.getTestNumber() - 1;
- }
- this.getTestSuite().getSuiteRows()[testNumber].loadTestCase(testCaseLoaded);
- }
- },
-
- _startSingleTest:function () {
- removeLoadListener(getApplicationWindow(), fnBind(this._startSingleTest, this));
- var singleTestName = this.controlPanel.getSingleTestName();
- testFrame.load(singleTestName, fnBind(this.startTest, this));
- },
-
- _registerCommandHandlers: function () {
- this.commandFactory = new CommandHandlerFactory();
- this.commandFactory.registerAll(selenium);
- },
-
- startTestSuite: function() {
- this.controlPanel.reset();
- this.metrics.resetMetrics();
- this.getTestSuite().reset();
- this.runAllTests = true;
- this.runNextTest();
- },
-
- runNextTest: function () {
- this.getTestSuite().updateSuiteWithResultOfPreviousTest();
- if (!this.runAllTests) {
- return;
- }
- this.getTestSuite().runNextTestInSuite();
- },
-
- startTest: function () {
- this.controlPanel.reset();
- testFrame.scrollToTop();
- //todo: move testFailed and storedVars to TestCase
- this.testFailed = false;
- storedVars = new Object();
- storedVars.nbsp = String.fromCharCode(160);
- storedVars.space = ' ';
- this.currentTest = new HtmlRunnerTestLoop(testFrame.getCurrentTestCase(), this.metrics, this.commandFactory);
- currentTest = this.currentTest;
- this.currentTest.start();
- },
-
- runSingleTest:function() {
- this.runAllTests = false;
- this.metrics.resetMetrics();
- this.startTest();
- }
-});
-
-var runInterval = 0;
-
-/** SeleniumFrame encapsulates an iframe element */
-var SeleniumFrame = classCreate();
-objectExtend(SeleniumFrame.prototype, {
-
- initialize : function(frame) {
- this.frame = frame;
- addLoadListener(this.frame, fnBind(this._handleLoad, this));
- },
-
- getWindow : function() {
- return this.frame.contentWindow;
- },
-
- getDocument : function() {
- return this.frame.contentWindow.document;
- },
-
- _handleLoad: function() {
- this._attachStylesheet();
- this._onLoad();
- if (this.loadCallback) {
- this.loadCallback();
- }
- },
-
- _attachStylesheet: function() {
- var d = this.getDocument();
- var head = d.getElementsByTagName('head').item(0);
- var styleLink = d.createElement("link");
- styleLink.rel = "stylesheet";
- styleLink.type = "text/css";
- if (browserVersion && browserVersion.isChrome) {
- // DGF We have to play a clever trick to get the right absolute path.
- // This trick works on most browsers, (not IE), but is only needed in
- // chrome
- var tempLink = window.document.createElement("link");
- tempLink.href = "selenium-test.css"; // this will become an absolute href
- styleLink.href = tempLink.href;
- } else {
- // this works in every browser (except Firefox in chrome mode)
- var styleSheetPath = window.location.pathname.replace(/[^\/\\]+$/, "selenium-test.css");
- if (browserVersion.isIE && window.location.protocol == "file:") {
- styleSheetPath = "file:///" + styleSheetPath;
- }
- styleLink.href = styleSheetPath;
- }
- // DGF You're only going to see this log message if you set defaultLogLevel=debug
- LOG.debug("styleLink.href="+styleLink.href);
- head.appendChild(styleLink);
- },
-
- _onLoad: function() {
- },
-
- scrollToTop : function() {
- this.frame.contentWindow.scrollTo(0, 0);
- },
-
- _setLocation: function(location) {
- var isChrome = browserVersion.isChrome || false;
- var isHTA = browserVersion.isHTA || false;
- // DGF TODO multiWindow
- location += (location.indexOf("?") == -1 ? "?" : "&");
- location += "thisIsChrome=" + isChrome + "&thisIsHTA=" + isHTA;
- if (browserVersion.isSafari) {
- // safari doesn't reload the page when the location equals to current location.
- // hence, set the location to blank so that the page will reload automatically.
- this.frame.src = "about:blank";
- this.frame.src = location;
- } else {
- this.frame.contentWindow.location.replace(location);
- }
- },
-
- load: function(/* url, [callback] */) {
- if (arguments.length > 1) {
- this.loadCallback = arguments[1];
-
- }
- this._setLocation(arguments[0]);
- }
-
-});
-
-/** HtmlTestSuiteFrame - encapsulates the suite iframe element */
-var HtmlTestSuiteFrame = classCreate();
-objectExtend(HtmlTestSuiteFrame.prototype, SeleniumFrame.prototype);
-objectExtend(HtmlTestSuiteFrame.prototype, {
-
- getCurrentTestSuite: function() {
- if (!this.currentTestSuite) {
- this.currentTestSuite = new HtmlTestSuite(this.getDocument());
- }
- return this.currentTestSuite;
- }
-
-});
-
-/** HtmlTestFrame - encapsulates the test-case iframe element */
-var HtmlTestFrame = classCreate();
-objectExtend(HtmlTestFrame.prototype, SeleniumFrame.prototype);
-objectExtend(HtmlTestFrame.prototype, {
-
- _onLoad: function() {
- this.currentTestCase = new HtmlTestCase(this.getWindow(), htmlTestRunner.getTestSuite().getCurrentRow());
- },
-
- getCurrentTestCase: function() {
- return this.currentTestCase;
- }
-
-});
-
-function onSeleniumLoad() {
- suiteFrame = new HtmlTestSuiteFrame(getSuiteFrame());
- testFrame = new HtmlTestFrame(getTestFrame());
- htmlTestRunner = new HtmlTestRunner();
-}
-
-var suiteFrame;
-var testFrame;
-
-function getSuiteFrame() {
- var f = sel$('testSuiteFrame');
- if (f == null) {
- f = top;
- // proxyInjection mode does not set selenium_myiframe
- }
- return f;
-}
-
-function getTestFrame() {
- var f = sel$('testFrame');
- if (f == null) {
- f = top;
- // proxyInjection mode does not set selenium_myiframe
- }
- return f;
-}
-
-var HtmlTestRunnerControlPanel = classCreate();
-objectExtend(HtmlTestRunnerControlPanel.prototype, URLConfiguration.prototype);
-objectExtend(HtmlTestRunnerControlPanel.prototype, {
- initialize: function() {
- this._acquireQueryString();
-
- this.runInterval = 0;
-
- this.highlightOption = sel$('highlightOption');
- this.pauseButton = sel$('pauseTest');
- this.stepButton = sel$('stepTest');
-
- this.highlightOption.onclick = fnBindAsEventListener((function() {
- this.setHighlightOption();
- }), this);
- this.pauseButton.onclick = fnBindAsEventListener(this.pauseCurrentTest, this);
- this.stepButton.onclick = fnBindAsEventListener(this.stepCurrentTest, this);
-
-
- this.speedController = new Control.Slider('speedHandle', 'speedTrack', {
- range: $R(0, 1000),
- onSlide: fnBindAsEventListener(this.setRunInterval, this),
- onChange: fnBindAsEventListener(this.setRunInterval, this)
- });
-
- this._parseQueryParameter();
- },
-
- setHighlightOption: function () {
- var isHighlight = this.highlightOption.checked;
- selenium.browserbot.setShouldHighlightElement(isHighlight);
- },
-
- _parseQueryParameter: function() {
- var tempRunInterval = this._getQueryParameter("runInterval");
- if (tempRunInterval) {
- this.setRunInterval(tempRunInterval);
- }
- this.highlightOption.checked = this._getQueryParameter("highlight");
- },
-
- setRunInterval: function(runInterval) {
- this.runInterval = runInterval;
- },
-
- setToPauseAtNextCommand: function() {
- this.runInterval = -1;
- },
-
- pauseCurrentTest: function () {
- this.setToPauseAtNextCommand();
- this._switchPauseButtonToContinue();
- },
-
- continueCurrentTest: function () {
- this.reset();
- currentTest.resume();
- },
-
- reset: function() {
- this.runInterval = this.speedController.value;
- this._switchContinueButtonToPause();
- },
-
- _switchContinueButtonToPause: function() {
- this.pauseButton.className = "cssPauseTest";
- this.pauseButton.onclick = fnBindAsEventListener(this.pauseCurrentTest, this);
- },
-
- _switchPauseButtonToContinue: function() {
- sel$('stepTest').disabled = false;
- this.pauseButton.className = "cssContinueTest";
- this.pauseButton.onclick = fnBindAsEventListener(this.continueCurrentTest, this);
- },
-
- stepCurrentTest: function () {
- this.setToPauseAtNextCommand();
- currentTest.resume();
- },
-
- isAutomatedRun: function() {
- return this._isQueryParameterTrue("auto");
- },
-
- shouldSaveResultsToFile: function() {
- return this._isQueryParameterTrue("save");
- },
-
- closeAfterTests: function() {
- return this._isQueryParameterTrue("close");
- },
-
- getTestSuiteName: function() {
- return this._getQueryParameter("test");
- },
-
- getTestNumber: function() {
- return this._getQueryParameter("testNumber");
- },
-
- getSingleTestName: function() {
- return this._getQueryParameter("singletest");
- },
-
- getAutoUrl: function() {
- return this._getQueryParameter("autoURL");
- },
-
- getDefaultLogLevel: function() {
- return this._getQueryParameter("defaultLogLevel");
- },
-
- getResultsUrl: function() {
- return this._getQueryParameter("resultsUrl");
- },
-
- _acquireQueryString: function() {
- if (this.queryString) return;
- if (browserVersion.isHTA) {
- var args = this._extractArgs();
- if (args.length < 2) return null;
- this.queryString = args[1];
- } else {
- this.queryString = location.search.substr(1);
- }
- }
-
-});
-
-var AbstractResultAwareRow = classCreate();
-objectExtend(AbstractResultAwareRow.prototype, {
-
- initialize: function(trElement) {
- this.trElement = trElement;
- },
-
- setStatus: function(status) {
- this.unselect();
- this.trElement.className = this.trElement.className.replace(/status_[a-z]+/, "");
- if (status) {
- addClassName(this.trElement, "status_" + status);
- }
- },
-
- select: function() {
- addClassName(this.trElement, "selected");
- safeScrollIntoView(this.trElement);
- },
-
- unselect: function() {
- removeClassName(this.trElement, "selected");
- },
-
- markPassed: function() {
- this.setStatus("passed");
- },
-
- markDone: function() {
- this.setStatus("done");
- },
-
- markFailed: function() {
- this.setStatus("failed");
- }
-
-});
-
-var TitleRow = classCreate();
-objectExtend(TitleRow.prototype, AbstractResultAwareRow.prototype);
-objectExtend(TitleRow.prototype, {
-
- initialize: function(trElement) {
- this.trElement = trElement;
- trElement.className = "title";
- }
-
-});
-
-var HtmlTestCaseRow = classCreate();
-objectExtend(HtmlTestCaseRow.prototype, AbstractResultAwareRow.prototype);
-objectExtend(HtmlTestCaseRow.prototype, {
-
- getCommand: function () {
- return new SeleniumCommand(getText(this.trElement.cells[0]),
- getText(this.trElement.cells[1]),
- getText(this.trElement.cells[2]),
- this.isBreakpoint());
- },
-
- markFailed: function(errorMsg) {
- AbstractResultAwareRow.prototype.markFailed.call(this, errorMsg);
- this.setMessage(errorMsg);
- },
-
- setMessage: function(message) {
- setText(this.trElement.cells[2], message);
- },
-
- reset: function() {
- this.setStatus(null);
- var thirdCell = this.trElement.cells[2];
- if (thirdCell) {
- if (thirdCell.originalHTML) {
- thirdCell.innerHTML = thirdCell.originalHTML;
- } else {
- thirdCell.originalHTML = thirdCell.innerHTML;
- }
- }
- },
-
- onClick: function() {
- if (this.trElement.isBreakpoint == undefined) {
- this.trElement.isBreakpoint = true;
- addClassName(this.trElement, "breakpoint");
- } else {
- this.trElement.isBreakpoint = undefined;
- removeClassName(this.trElement, "breakpoint");
- }
- },
-
- addBreakpointSupport: function() {
- elementSetStyle(this.trElement, {"cursor" : "pointer"});
- this.trElement.onclick = fnBindAsEventListener(function() {
- this.onClick();
- }, this);
- },
-
- isBreakpoint: function() {
- if (this.trElement.isBreakpoint == undefined || this.trElement.isBreakpoint == null) {
- return false
- }
- return this.trElement.isBreakpoint;
- }
-});
-
-var HtmlTestSuiteRow = classCreate();
-objectExtend(HtmlTestSuiteRow.prototype, AbstractResultAwareRow.prototype);
-objectExtend(HtmlTestSuiteRow.prototype, {
-
- initialize: function(trElement, testFrame, htmlTestSuite) {
- this.trElement = trElement;
- this.testFrame = testFrame;
- this.htmlTestSuite = htmlTestSuite;
- this.link = trElement.getElementsByTagName("a")[0];
- this.link.onclick = fnBindAsEventListener(this._onClick, this);
- },
-
- reset: function() {
- this.setStatus(null);
- },
-
- _onClick: function() {
- this.loadTestCase(null);
- return false;
- },
-
- loadTestCase: function(onloadFunction) {
- this.htmlTestSuite.unselectCurrentRow();
- this.select();
- this.htmlTestSuite.currentRowInSuite = this.trElement.rowIndex - 1;
- // If the row has a stored results table, use that
- var resultsFromPreviousRun = this.trElement.cells[1];
- if (resultsFromPreviousRun) {
- // todo: delegate to TestFrame, e.g.
- // this.testFrame.restoreTestCase(resultsFromPreviousRun.innerHTML);
- var testBody = this.testFrame.getDocument().body;
- testBody.innerHTML = resultsFromPreviousRun.innerHTML;
- this.testFrame._onLoad();
- if (onloadFunction) {
- onloadFunction();
- }
- } else {
- this.testFrame.load(this.link.href, onloadFunction);
- }
- },
-
- saveTestResults: function() {
- // todo: GLOBAL ACCESS!
- var resultHTML = this.testFrame.getDocument().body.innerHTML;
- if (!resultHTML) return;
-
- // todo: why create this div?
- var divElement = this.trElement.ownerDocument.createElement("div");
- divElement.innerHTML = resultHTML;
-
- var hiddenCell = this.trElement.ownerDocument.createElement("td");
- hiddenCell.appendChild(divElement);
- hiddenCell.style.display = "none";
-
- this.trElement.appendChild(hiddenCell);
- }
-
-});
-
-var HtmlTestSuite = classCreate();
-objectExtend(HtmlTestSuite.prototype, {
-
- initialize: function(suiteDocument) {
- this.suiteDocument = suiteDocument;
- this.suiteRows = this._collectSuiteRows();
- var testTable = this.getTestTable();
- if (!testTable) return;
- this.titleRow = new TitleRow(testTable.rows[0]);
- this.reset();
- },
-
- reset: function() {
- this.failed = false;
- this.currentRowInSuite = -1;
- this.titleRow.setStatus(null);
- for (var i = 0; i < this.suiteRows.length; i++) {
- var row = this.suiteRows[i];
- row.reset();
- }
- },
-
- getSuiteRows: function() {
- return this.suiteRows;
- },
-
- getTestTable: function() {
- var tables = sel$A(this.suiteDocument.getElementsByTagName("table"));
- return tables[0];
- },
-
- isAvailable: function() {
- return this.getTestTable() != null;
- },
-
- _collectSuiteRows: function () {
- var result = [];
- var tables = sel$A(this.suiteDocument.getElementsByTagName("table"));
- var testTable = tables[0];
- if (!testTable) return;
- for (rowNum = 1; rowNum < testTable.rows.length; rowNum++) {
- var rowElement = testTable.rows[rowNum];
- result.push(new HtmlTestSuiteRow(rowElement, testFrame, this));
- }
-
- // process the unsuited rows as well
- for (var tableNum = 1; tableNum < sel$A(this.suiteDocument.getElementsByTagName("table")).length; tableNum++) {
- testTable = tables[tableNum];
- for (rowNum = 1; rowNum < testTable.rows.length; rowNum++) {
- var rowElement = testTable.rows[rowNum];
- new HtmlTestSuiteRow(rowElement, testFrame, this);
- }
- }
- return result;
- },
-
- getCurrentRow: function() {
- if (this.currentRowInSuite == -1) {
- return null;
- }
- return this.suiteRows[this.currentRowInSuite];
- },
-
- unselectCurrentRow: function() {
- var currentRow = this.getCurrentRow()
- if (currentRow) {
- currentRow.unselect();
- }
- },
-
- markFailed: function() {
- this.failed = true;
- this.titleRow.markFailed();
- },
-
- markDone: function() {
- if (!this.failed) {
- this.titleRow.markPassed();
- }
- },
-
- _startCurrentTestCase: function() {
- this.getCurrentRow().loadTestCase(fnBind(htmlTestRunner.startTest, htmlTestRunner));
- },
-
- _onTestSuiteComplete: function() {
- this.markDone();
- new SeleniumTestResult(this.failed, this.getTestTable()).post();
- },
-
- updateSuiteWithResultOfPreviousTest: function() {
- if (this.currentRowInSuite >= 0) {
- this.getCurrentRow().saveTestResults();
- }
- },
-
- runNextTestInSuite: function() {
- this.currentRowInSuite++;
-
- // If we are done with all of the tests, set the title bar as pass or fail
- if (this.currentRowInSuite >= this.suiteRows.length) {
- this._onTestSuiteComplete();
- } else {
- this._startCurrentTestCase();
- }
- }
-
-
-
-});
-
-var SeleniumTestResult = classCreate();
-objectExtend(SeleniumTestResult.prototype, {
-
-// Post the results to a servlet, CGI-script, etc. The URL of the
-// results-handler defaults to "/postResults", but an alternative location
-// can be specified by providing a "resultsUrl" query parameter.
-//
-// Parameters passed to the results-handler are:
-// result: passed/failed depending on whether the suite passed or failed
-// totalTime: the total running time in seconds for the suite.
-//
-// numTestPasses: the total number of tests which passed.
-// numTestFailures: the total number of tests which failed.
-//
-// numCommandPasses: the total number of commands which passed.
-// numCommandFailures: the total number of commands which failed.
-// numCommandErrors: the total number of commands which errored.
-//
-// suite: the suite table, including the hidden column of test results
-// testTable.1 to testTable.N: the individual test tables
-//
- initialize: function (suiteFailed, suiteTable) {
- this.controlPanel = htmlTestRunner.controlPanel;
- this.metrics = htmlTestRunner.metrics;
- this.suiteFailed = suiteFailed;
- this.suiteTable = suiteTable;
- },
-
- post: function () {
- if (!this.controlPanel.isAutomatedRun()) {
- return;
- }
- var form = document.createElement("form");
- document.body.appendChild(form);
-
- form.id = "resultsForm";
- form.method = "post";
- form.target = "selenium_myiframe";
-
- var resultsUrl = this.controlPanel.getResultsUrl();
- if (!resultsUrl) {
- resultsUrl = "./postResults";
- }
-
- var actionAndParameters = resultsUrl.split('?', 2);
- form.action = actionAndParameters[0];
- var resultsUrlQueryString = actionAndParameters[1];
-
- form.createHiddenField = function(name, value) {
- input = document.createElement("input");
- input.type = "hidden";
- input.name = name;
- input.value = value;
- this.appendChild(input);
- };
-
- if (resultsUrlQueryString) {
- var clauses = resultsUrlQueryString.split('&');
- for (var i = 0; i < clauses.length; i++) {
- var keyValuePair = clauses[i].split('=', 2);
- var key = unescape(keyValuePair[0]);
- var value = unescape(keyValuePair[1]);
- form.createHiddenField(key, value);
- }
- }
-
- form.createHiddenField("selenium.version", Selenium.version);
- form.createHiddenField("selenium.revision", Selenium.revision);
-
- form.createHiddenField("result", this.suiteFailed ? "failed" : "passed");
-
- form.createHiddenField("totalTime", Math.floor((this.metrics.currentTime - this.metrics.startTime) / 1000));
- form.createHiddenField("numTestPasses", this.metrics.numTestPasses);
- form.createHiddenField("numTestFailures", this.metrics.numTestFailures);
- form.createHiddenField("numCommandPasses", this.metrics.numCommandPasses);
- form.createHiddenField("numCommandFailures", this.metrics.numCommandFailures);
- form.createHiddenField("numCommandErrors", this.metrics.numCommandErrors);
-
- // Create an input for each test table. The inputs are named
- // testTable.1, testTable.2, etc.
- for (rowNum = 1; rowNum < this.suiteTable.rows.length; rowNum++) {
- // If there is a second column, then add a new input
- if (this.suiteTable.rows[rowNum].cells.length > 1) {
- var resultCell = this.suiteTable.rows[rowNum].cells[1];
- form.createHiddenField("testTable." + rowNum, resultCell.innerHTML);
- // remove the resultCell, so it's not included in the suite HTML
- resultCell.parentNode.removeChild(resultCell);
- }
- }
-
- form.createHiddenField("numTestTotal", rowNum-1);
-
- // Add HTML for the suite itself
- form.createHiddenField("suite", this.suiteTable.parentNode.innerHTML);
-
- var logMessages = [];
- while (LOG.pendingMessages.length > 0) {
- var msg = LOG.pendingMessages.shift();
- logMessages.push(msg.type);
- logMessages.push(": ");
- logMessages.push(msg.msg);
- logMessages.push('\n');
- }
- var logOutput = logMessages.join("");
- form.createHiddenField("log", logOutput);
-
- if (this.controlPanel.shouldSaveResultsToFile()) {
- this._saveToFile(resultsUrl, form);
- } else {
- form.submit();
- }
- document.body.removeChild(form);
- if (this.controlPanel.closeAfterTests()) {
- window.top.close();
- }
- },
-
- _saveToFile: function (fileName, form) {
- // This only works when run as an IE HTA
- var inputs = new Object();
- for (var i = 0; i < form.elements.length; i++) {
- inputs[form.elements[i].name] = form.elements[i].value;
- }
-
- var objFSO = new ActiveXObject("Scripting.FileSystemObject")
-
- // DGF get CSS
- var styles = "";
- try {
- var styleSheetPath = window.location.pathname.replace(/[^\/\\]+$/, "selenium-test.css");
- if (window.location.protocol == "file:") {
- var stylesFile = objFSO.OpenTextFile(styleSheetPath, 1);
- styles = stylesFile.ReadAll();
- } else {
- var xhr = XmlHttp.create();
- xhr.open("GET", styleSheetPath, false);
- xhr.send("");
- styles = xhr.responseText;
- }
- } catch (e) {}
-
- var scriptFile = objFSO.CreateTextFile(fileName);
-
-
- scriptFile.WriteLine("Test suite results");
- scriptFile.WriteLine("\nTest suite results
" +
- "\n\n\n\n| result: | \n" + inputs["result"] + " | \n" +
- "
\n\n| totalTime: | \n" + inputs["totalTime"] + " | \n
\n" +
- "\n| numTestTotal: | \n" + inputs["numTestTotal"] + " | \n
\n" +
- "\n| numTestPasses: | \n" + inputs["numTestPasses"] + " | \n
\n" +
- "\n| numTestFailures: | \n" + inputs["numTestFailures"] + " | \n
\n" +
- "\n| numCommandPasses: | \n" + inputs["numCommandPasses"] + " | \n
\n" +
- "\n| numCommandFailures: | \n" + inputs["numCommandFailures"] + " | \n
\n" +
- "\n| numCommandErrors: | \n" + inputs["numCommandErrors"] + " | \n
\n" +
- "\n| " + inputs["suite"] + " | \n | \n
");
- var testNum = inputs["numTestTotal"];
-
- for (var rowNum = 1; rowNum <= testNum; rowNum++) {
- scriptFile.WriteLine("\n| " + inputs["testTable." + rowNum] + " | \n | \n
");
- }
- scriptFile.WriteLine("
");
- var log = inputs["log"];
- log=log.replace(/&/gm,"&").replace(//gm,">").replace(/"/gm,""").replace(/'/gm,"'");
- scriptFile.WriteLine(log);
- scriptFile.WriteLine("");
- scriptFile.Close();
- }
-});
-
-/** HtmlTestCase encapsulates an HTML test document */
-var HtmlTestCase = classCreate();
-objectExtend(HtmlTestCase.prototype, {
-
- initialize: function(testWindow, htmlTestSuiteRow) {
- if (testWindow == null) {
- throw "testWindow should not be null";
- }
- if (htmlTestSuiteRow == null) {
- throw "htmlTestSuiteRow should not be null";
- }
- this.testWindow = testWindow;
- this.testDocument = testWindow.document;
- this.pathname = "'unknown'";
- try {
- if (this.testWindow.location) {
- this.pathname = this.testWindow.location.pathname;
- }
- } catch (e) {}
-
- this.htmlTestSuiteRow = htmlTestSuiteRow;
- this.headerRow = new TitleRow(this.testDocument.getElementsByTagName("tr")[0]);
- this.commandRows = this._collectCommandRows();
- this.nextCommandRowIndex = 0;
- this._addBreakpointSupport();
- },
-
- _collectCommandRows: function () {
- var commandRows = [];
- var tables = sel$A(this.testDocument.getElementsByTagName("table"));
- var self = this;
- for (var i = 0; i < tables.length; i++) {
- var table = tables[i];
- var tableRows = sel$A(table.rows);
- for (var j = 0; j < tableRows.length; j++) {
- var candidateRow = tableRows[j];
- if (self.isCommandRow(candidateRow)) {
- commandRows.push(new HtmlTestCaseRow(candidateRow));
- }
- }
- }
- return commandRows;
- },
-
- isCommandRow: function (row) {
- return row.cells.length >= 3;
- },
-
- reset: function() {
- /**
- * reset the test to runnable state
- */
- this.nextCommandRowIndex = 0;
-
- this.setStatus('');
- for (var i = 0; i < this.commandRows.length; i++) {
- var row = this.commandRows[i];
- row.reset();
- }
-
- // remove any additional fake "error" row added to the end of the document
- var errorElement = this.testDocument.getElementById('error');
- if (errorElement) {
- errorElement.parentNode.removeChild(errorElement);
- }
- },
-
- getCommandRows: function () {
- return this.commandRows;
- },
-
- setStatus: function(status) {
- this.headerRow.setStatus(status);
- },
-
- markFailed: function() {
- this.setStatus("failed");
- this.htmlTestSuiteRow.markFailed();
- },
-
- markPassed: function() {
- this.setStatus("passed");
- this.htmlTestSuiteRow.markPassed();
- },
-
- addErrorMessage: function(errorMsg, currentRow) {
- errorMsg = errorMsg.replace(/ /g, String.fromCharCode(160)).replace("\n", '\\n');
- if (currentRow) {
- currentRow.markFailed(errorMsg);
- } else {
- var errorElement = this.testDocument.createElement("p");
- errorElement.id = "error";
- setText(errorElement, errorMsg);
- this.testDocument.body.appendChild(errorElement);
- errorElement.className = "status_failed";
- }
- },
-
- _addBreakpointSupport: function() {
- for (var i = 0; i < this.commandRows.length; i++) {
- var row = this.commandRows[i];
- row.addBreakpointSupport();
- }
- },
-
- hasMoreCommandRows: function() {
- return this.nextCommandRowIndex < this.commandRows.length;
- },
-
- getNextCommandRow: function() {
- if (this.hasMoreCommandRows()) {
- return this.commandRows[this.nextCommandRowIndex++];
- }
- return null;
- }
-
-});
-
-
-// TODO: split out an JavascriptTestCase class to handle the "sejs" stuff
-
-var get_new_rows = function() {
- var row_array = new Array();
- for (var i = 0; i < new_block.length; i++) {
-
- var new_source = (new_block[i][0].tokenizer.source.slice(new_block[i][0].start,
- new_block[i][0].end));
-
- var row = 'getEval | ' +
- 'currentTest.doNextCommand() | ' +
- '' + new_source + ' | ' +
- ' | '
-
- row_array.push(row);
- }
- return row_array;
-};
-
-
-var Metrics = classCreate();
-objectExtend(Metrics.prototype, {
- initialize: function() {
- // The number of tests run
- this.numTestPasses = 0;
- // The number of tests that have failed
- this.numTestFailures = 0;
- // The number of commands which have passed
- this.numCommandPasses = 0;
- // The number of commands which have failed
- this.numCommandFailures = 0;
- // The number of commands which have caused errors (element not found)
- this.numCommandErrors = 0;
- // The time that the test was started.
- this.startTime = null;
- // The current time.
- this.currentTime = null;
- },
-
- printMetrics: function() {
- setText(sel$('commandPasses'), this.numCommandPasses);
- setText(sel$('commandFailures'), this.numCommandFailures);
- setText(sel$('commandErrors'), this.numCommandErrors);
- setText(sel$('testRuns'), this.numTestPasses + this.numTestFailures);
- setText(sel$('testFailures'), this.numTestFailures);
-
- this.currentTime = new Date().getTime();
-
- var timeDiff = this.currentTime - this.startTime;
- var totalSecs = Math.floor(timeDiff / 1000);
-
- var minutes = Math.floor(totalSecs / 60);
- var seconds = totalSecs % 60;
-
- setText(sel$('elapsedTime'), this._pad(minutes) + ":" + this._pad(seconds));
- },
-
-// Puts a leading 0 on num if it is less than 10
- _pad: function(num) {
- return (num > 9) ? num : "0" + num;
- },
-
- resetMetrics: function() {
- this.numTestPasses = 0;
- this.numTestFailures = 0;
- this.numCommandPasses = 0;
- this.numCommandFailures = 0;
- this.numCommandErrors = 0;
- this.startTime = new Date().getTime();
- }
-
-});
-
-var HtmlRunnerCommandFactory = classCreate();
-objectExtend(HtmlRunnerCommandFactory.prototype, {
-
- initialize: function(seleniumCommandFactory, testLoop) {
- this.seleniumCommandFactory = seleniumCommandFactory;
- this.testLoop = testLoop;
- this.handlers = {};
- //todo: register commands
- },
-
- getCommandHandler: function(command) {
- if (this.handlers[command]) {
- return this.handlers[command];
- }
- return this.seleniumCommandFactory.getCommandHandler(command);
- }
-
-});
-
-var HtmlRunnerTestLoop = classCreate();
-objectExtend(HtmlRunnerTestLoop.prototype, new TestLoop());
-objectExtend(HtmlRunnerTestLoop.prototype, {
- initialize: function(htmlTestCase, metrics, seleniumCommandFactory) {
-
- this.commandFactory = new HtmlRunnerCommandFactory(seleniumCommandFactory, this);
- this.metrics = metrics;
-
- this.htmlTestCase = htmlTestCase;
- LOG.info("Starting test " + htmlTestCase.pathname);
-
- this.currentRow = null;
- this.currentRowIndex = 0;
-
- // used for selenium tests in javascript
- this.currentItem = null;
- this.commandAgenda = new Array();
- this.expectedFailure = null;
- this.expectedFailureType = null;
-
- this.htmlTestCase.reset();
- },
-
- _advanceToNextRow: function() {
- if (this.htmlTestCase.hasMoreCommandRows()) {
- this.currentRow = this.htmlTestCase.getNextCommandRow();
- if (this.sejsElement) {
- this.currentItem = agenda.pop();
- this.currentRowIndex++;
- }
- } else {
- this.currentRow = null;
- this.currentItem = null;
- }
- },
-
- nextCommand : function() {
- this._advanceToNextRow();
- if (this.currentRow == null) {
- return null;
- }
- return this.currentRow.getCommand();
- },
-
- commandStarted : function() {
- sel$('pauseTest').disabled = false;
- this.currentRow.select();
- this.metrics.printMetrics();
- },
-
- commandComplete : function(result) {
- this._checkExpectedFailure(result);
- if (result.failed) {
- this.metrics.numCommandFailures += 1;
- this._recordFailure(result.failureMessage);
- } else if (result.passed) {
- this.metrics.numCommandPasses += 1;
- this.currentRow.markPassed();
- } else {
- this.currentRow.markDone();
- }
- },
-
- _checkExpectedFailure : function(result) {
- if (this.expectedFailure != null) {
- if (this.expectedFailureJustSet) {
- this.expectedFailureJustSet = false;
- return;
- }
- if (!result.failed) {
- result.passed = false;
- result.failed = true;
- result.failureMessage = "Expected " + this.expectedFailureType + " did not occur.";
- } else {
- if (PatternMatcher.matches(this.expectedFailure, result.failureMessage)) {
- var failureType = result.error ? "error" : "failure";
- if (failureType == this.expectedFailureType) {
- result.failed = false;
- result.passed = true;
- } else {
- result.failed = true;
- result.failureMessage = "Expected "+this.expectedFailureType+", but "+failureType+" occurred instead";
- }
- } else {
- result.failed = true;
- result.failureMessage = "Expected " + this.expectedFailureType + " message '" + this.expectedFailure
- + "' but was '" + result.failureMessage + "'";
- }
- }
- this.expectedFailure = null;
- this.expectedFailureType = null;
- }
- },
-
- commandError : function(errorMessage) {
- var tempResult = {};
- tempResult.passed = false;
- tempResult.failed = true;
- tempResult.error = true;
- tempResult.failureMessage = errorMessage;
- this._checkExpectedFailure(tempResult);
- if (tempResult.passed) {
- this.currentRow.markDone();
- return true;
- }
- errorMessage = tempResult.failureMessage;
- this.metrics.numCommandErrors += 1;
- this._recordFailure(errorMessage);
- },
-
- _recordFailure : function(errorMsg) {
- LOG.warn("currentTest.recordFailure: " + errorMsg);
- htmlTestRunner.markFailed();
- this.htmlTestCase.addErrorMessage(errorMsg, this.currentRow);
- },
-
- testComplete : function() {
- sel$('pauseTest').disabled = true;
- sel$('stepTest').disabled = true;
- if (htmlTestRunner.testFailed) {
- this.htmlTestCase.markFailed();
- this.metrics.numTestFailures += 1;
- } else {
- this.htmlTestCase.markPassed();
- this.metrics.numTestPasses += 1;
- }
-
- this.metrics.printMetrics();
-
- window.setTimeout(function() {
- htmlTestRunner.runNextTest();
- }, 1);
- },
-
- getCommandInterval : function() {
- return htmlTestRunner.controlPanel.runInterval;
- },
-
- pause : function() {
- htmlTestRunner.controlPanel.pauseCurrentTest();
- },
-
- doNextCommand: function() {
- var _n = this.currentItem[0];
- var _x = this.currentItem[1];
-
- new_block = new Array()
- execute(_n, _x);
- if (new_block.length > 0) {
- var the_table = this.htmlTestCase.testDocument.getElementById("se-js-table")
- var loc = this.currentRowIndex
- var new_rows = get_new_rows()
-
- // make the new statements visible on screen...
- for (var i = 0; i < new_rows.length; i++) {
- the_table.insertRow(loc + 1);
- the_table.rows[loc + 1].innerHTML = new_rows[i];
- this.commandRows.unshift(the_table.rows[loc + 1])
- }
-
- }
- }
-
-});
-
-Selenium.prototype.doPause = function(waitTime) {
- /** Wait for the specified amount of time (in milliseconds)
- * @param waitTime the amount of time to sleep (in milliseconds)
- */
- // todo: should not refer to currentTest directly
- currentTest.pauseInterval = waitTime;
-};
-
-Selenium.prototype.doBreak = function() {
- /** Halt the currently running test, and wait for the user to press the Continue button.
- * This command is useful for debugging, but be careful when using it, because it will
- * force automated tests to hang until a user intervenes manually.
- */
- // todo: should not refer to controlPanel directly
- htmlTestRunner.controlPanel.setToPauseAtNextCommand();
-};
-
-Selenium.prototype.doStore = function(expression, variableName) {
- /** This command is a synonym for storeExpression.
- * @param expression the value to store
- * @param variableName the name of a variable in which the result is to be stored.
- */
- storedVars[variableName] = expression;
-}
-
-/*
- * Click on the located element, and attach a callback to notify
- * when the page is reloaded.
- */
-// DGF TODO this code has been broken for some time... what is it trying to accomplish?
-Selenium.prototype.XXXdoModalDialogTest = function(returnValue) {
- this.browserbot.doModalDialogTest(returnValue);
-};
-
-Selenium.prototype.doEcho = function(message) {
- /** Prints the specified message into the third table cell in your Selenese tables.
- * Useful for debugging.
- * @param message the message to print
- */
- currentTest.currentRow.setMessage(message);
-}
-
-/*
- * doSetSpeed and getSpeed are already defined in selenium-api.js,
- * so we're defining these functions in a tricky way so that doc.js doesn't
- * try to read API doc from the function definitions here.
- */
-Selenium.prototype._doSetSpeed = function(value) {
- var milliseconds = parseInt(value);
- if (milliseconds < 0) milliseconds = 0;
- htmlTestRunner.controlPanel.speedController.setValue(milliseconds);
- htmlTestRunner.controlPanel.setRunInterval(milliseconds);
-}
-Selenium.prototype.doSetSpeed = Selenium.prototype._doSetSpeed;
-
-Selenium.prototype._getSpeed = function() {
- return htmlTestRunner.controlPanel.runInterval;
-}
-Selenium.prototype.getSpeed = Selenium.prototype._getSpeed;
-
-Selenium.prototype.assertSelected = function(selectLocator, optionLocator) {
- /**
- * Verifies that the selected option of a drop-down satisfies the optionSpecifier. Note that this command is deprecated; you should use assertSelectedLabel, assertSelectedValue, assertSelectedIndex, or assertSelectedId instead.
- *
- * See the select command for more information about option locators.
- *
- * @param selectLocator an element locator identifying a drop-down menu
- * @param optionLocator an option locator, typically just an option label (e.g. "John Smith")
- */
- var element = this.page().findElement(selectLocator);
- var locator = this.optionLocatorFactory.fromLocatorString(optionLocator);
- if (element.selectedIndex == -1)
- {
- Assert.fail("No option selected");
- }
- locator.assertSelected(element);
-};
-
-Selenium.prototype.assertFailureOnNext = function(message) {
- /**
- * Tell Selenium to expect a failure on the next command execution.
- * @param message The failure message we should expect. This command will fail if the wrong failure message appears.
- */
- if (!message) {
- throw new SeleniumError("Message must be provided");
- }
-
- currentTest.expectedFailure = message;
- currentTest.expectedFailureType = "failure";
- currentTest.expectedFailureJustSet = true;
-};
-
-Selenium.prototype.assertErrorOnNext = function(message) {
- /**
- * Tell Selenium to expect an error on the next command execution.
- * @param message The error message we should expect. This command will fail if the wrong error message appears.
- */
- // This command temporarily installs a CommandFactory that generates
- // CommandHandlers that expect an error.
- if (!message) {
- throw new SeleniumError("Message must be provided");
- }
-
- currentTest.expectedFailure = message;
- currentTest.expectedFailureType = "error";
- currentTest.expectedFailureJustSet = true;
-};
-
diff --git a/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-version.js b/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-version.js
deleted file mode 100644
index 5334c07b..00000000
--- a/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-version.js
+++ /dev/null
@@ -1,5 +0,0 @@
-Selenium.version = "1.0-beta-2";
-Selenium.revision = "2330";
-
-window.top.document.title += " v" + Selenium.version + " [" + Selenium.revision + "]";
-
diff --git a/vendor/plugins/selenium-on-rails/selenium-core/scripts/ui-doc.html b/vendor/plugins/selenium-on-rails/selenium-core/scripts/ui-doc.html
deleted file mode 100644
index fe7d20d4..00000000
--- a/vendor/plugins/selenium-on-rails/selenium-core/scripts/ui-doc.html
+++ /dev/null
@@ -1,803 +0,0 @@
-
-
-Selenium UI-Element Reference
-
-
-
-
-
-Selenium UI-Element Reference
-
-Introduction
-
-UI-Element is a Selenium feature that makes it possible to define a mapping between semantically meaningful names of elements on webpages, and the elements themselves. The mapping is defined using JavaScript Object Notation, and may be shared both by the IDE and tests run via Selenium RC. It also offers a single point of update should the user interface of the application under test change.
-
-Terminology
-
-
-- Page
-- A unique URL, and the contents available by accessing that URL. A page typically consists of several interactive page elements. A page may also be considered a DOM document object, complete with URL information.
-- Page element
-- An element on the actual webpage. Generally speaking, an element is anything the user might interact with, or anything that contains meaningful content. More specifically, an element is realized as a Document Object Model (DOM) node and its contents. So when we refer to a page element, we mean both of the following, at the same time:
-
-- something on the page
-- its DOM representation, including its relationship with other page elements
-
-
-- Pageset
-- A set of pages that share some set of common page elements. For example, I might be able to log into my application from several different pages. If certain page elements on each of those pages appear similarly (i.e. their DOM representations are identical), those pages can be grouped into a pageset with respect to these page elements. There is no restriction on how many pagesets a given page can be a member of. Similarly, a UI element belong to multiple pagesets. A pageset is commonly represented by a regular expression which matches the URL's that uniquely identify pages; however, there are cases when the page content must be considered to determine pageset membership. A pageset also has a name.
-- UI element
-- A mapping between a meaningful name for a page element, and the means to locate that page element's DOM node. The page element is located via a locator. UI elements belong to pagesets.
-- UI argument
-- An optional piece of logic that determines how the locator is generated by a UI element. Typically used when similar page elements appear multiple times on the same page, and you want to address them all with a single UI element. For example, if a page presents 20 clickable search results, the index of the search result might be a UI argument.
-- UI map
-- A collection of pagesets, which in turn contain UI elements. The UI map is the medium for translating between UI specifier strings, page elements, and UI elements.
-- UI specifier string
-- A bit of text containing a pageset name, a UI element name, and optionally arguments that modify the way a locator is constructed by the UI element. UI specifier strings are intended to be the human-readable identifier for page elements.
-- Rollup rule
-- Logic that describes how one or more Selenium commands can be grouped into a single command, and how that single command may be expanded into its component Selenium commands. The single command is referred to simply as a "rollup".
-- Command matcher
-- Typically folded into a rollup rule, it matches one or more Selenium commands and optionally sets values for rollup arguments based on the matched commands. A rollup rule usually has one or more command matchers.
-- Rollup argument
-- An optional piece of logic that modifies the command expansion of a rollup.
-
-
-The Basics
-
-Getting Motivated
-
-Question: Why use UI-Element? Answer: So your testcases can look like this (boilerplate code omitted):
-
-
-<tr>
- <td>open</td>
- <td>/</td>
- <td></td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>ui=allPages::section(section=topics)</td>
- <td></td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>ui=topicListingPages::topic(topic=Process)</td>
- <td></td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>ui=subtopicListingPages::subtopic(subtopic=Creativity)</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>ui=subtopicArticleListingPages::article(index=2)</td>
- <td></td>
-</tr>
-
-
-Including the Right Files
-
-UI-Element is now fully integrated with Selenium. The only additional file that needs to be specified is your map definitions file. In the IDE, add it to the comma-delimited Selenium Core extensions field of the IDE options. A sample definition file created for the website alistapart.com is included in the distribution and is available here:
-
-chrome://selenium-ide/content/selenium/scripts/ui-map-sample.js
-
-You might want to experiment with the sample map to get a feel for UI-Element. For the Selenium RC, you have two options. The map file may be included in the user-extensions.js file specified at startup with the -userExtensions switch. Or, you may load it dynamically with the variant of the setUserExtensionJs command in your driver language, before the browser is started.
-
-Map Definitions File Syntax
-
-This is the general format of a map file:
-
-
-var map = new UIMap();
-
-map.addPageset({
- name: 'aPageset'
- , ...
-});
-map.addElement('aPageset', { ... });
-map.addElement('aPageset', { ... });
-...
-
-map.addPageset({
- name: 'anotherPageset'
- , ...
-});
-...
-
-
-The map object is initialized by creating a new UIMap object. Next, a pageset is defined. Then one or more UI elements are defined for that pageset. More pagesets are defined, each with corresponding UI elements. That's it!
-
-Pageset Shorthand
-
-The method signature of addPageset() is (pagesetShorthand). pagesetShorthand is a JSON description of the pageset. Here's a minimal example:
-
-
-map.addPageset({
- name: 'allPages'
- , description: 'contains elements common to all pages'
- , pathRegexp: '.*'
-});
-
-
-Here's a table containing information about the attributes of the Pageset object. The conditionally required or unrequired items are for IDE recording support only.
-
-
-| Name |
- Required? |
- Description |
- Example |
-
-| name |
- Yes |
- (String) the name of the pageset. This should be unique within the map. |
- name: 'shopPages' |
-
-| description |
- Yes |
- (String) a description of the pageset. Ideally, this will give the reader an idea of what types of UI elements the pageset will have. |
- description: 'all pages displaying product' |
-
-| pathPrefix |
- No |
- (String) the path of the URL of all included pages in this pageset will contain this prefix. For example, if all pages are of the form http://www.example.com/gallery/light-show/, the page prefix might be gallery/ . |
- pathPrefix: 'gallery/' |
-
-paths pathRegexp |
- Conditional |
- (Array | String) either a list of path strings, or a string that represents a regular expression. One or the other should be defined, but not both. If an array, it enumerates pages that are included in the pageset. If a regular expression, any pages whose URL paths match the expression are considered part of the pageset. In either case, the part of the URL being matched (called the path) is the part following the domain, less any training slash, and not including the CGI parameters. For example:
-
- - http://www.example.com/articles/index.php
- - http://www.example.com/articles/2579?lang=en_US
- - http://www.example.com/articles/selenium/
-
- The entire path must match (however, pathPrefix is taken into account if specified). If specified as a regular expression, the two regular expression characters ^ and $ marking the start and end of the matched string are included implicitly, and should not be specified in this string. Please notice too that backslashes must be backslash-escaped in javascript strings. |
- paths: [
- 'gotoHome.do'
- , 'gotoAbout.do'
- , 'gotoFaq.do'
-]
- pathRegexp: 'goto(Home|About|Faq)\\.do'
- |
-| paramRegexps |
- No |
- (Object) a mapping from URL parameter names to regular expression strings which must match their values. If specified, the set of pages potentially included in this pageset will be further filtered by URL parameter values. There is no filtering by parameter value by default. |
- paramRegexps: {
- dept: '^[abcd]$'
- , team: 'marketing'
-} |
-
-| pageContent |
- Conditional |
- (Function) a function that tests whether a page, represented by its document object, is contained in the pageset, and returns true if and only if this is the case. If specified, the set of pages potentially included in this pageset will be further filtered by content, after URL and URL parameter filtering.
- Since the URL is available from the document object (document.location.href), you may encode the logic used for the paths and pathRegexp attributes all into the definition of pageContent. Thus, you may choose to omit the former if and only if using pageContent. Of course, you may continue to use them for clarity. |
- pageContent: function(doc) {
- var id = 'address-tab';
- return doc.getElementById(id) != null;
-} |
-
-
-
-
-
-The method signature of addElement() is (pagesetName, uiElementShorthand). pagesetName is the name of the pageset the UI element is being added to. uiElementShorthand is a complete JSON description of the UI element object in shorthand notation.
-
-In its simplest form, a UI element object looks like this:
-
-
-map.addElement('allPages', {
- name: 'about_link'
- , description: 'link to the about page'
- , locator: "//a[contains(@href, 'about.php')]"
-});
-
-
-Here's a table containing information about the attributes of the UI element object. The asterisk (*) means any string:
-
-
-| Name |
- Required? |
- Description |
- Example |
-
-| name |
- Yes |
- (String) the name of the UI element |
- name: 'article' |
-
-| description |
- Yes |
- (String) a description of the UI element. This is the main documentation for this UI element, so the more detailed, the better. |
- description: 'front or issue page link to article' |
-
-| args |
- No |
- (Array) a list of arguments that modify the getLocator() method. If unspecified, it will be treated as an empty list. |
- [
- { name: 'index'
- , description: 'the index of the author, by article'
- , defaultValues: range(1, 5) }
-]See section below elaborating on attributes of argument objects. |
-
-locator getLocator() xpathgetXPath() |
- Yes |
- (String | Function) either a fixed locator string, or a function that returns a locator string given a set of arguments. One or the other should be defined, but not both. Under the sheets, the locator attribute eventually gets transcripted as a getLocator() function. As of ui0.7, xpath and getXPath() have been deprecated. They are still supported for backward compatibility. |
- locator: 'submit'
- getLocator: function(args) {
- return 'css=div.item:nth-child(' + args.index + ')'
- + ' > h5 > a';
-}
- getLocator: function(args) {
- var label = args.label;
- var id = this._idMap[label];
- return '//input[@id=' + id.quoteForXPath() + ']';
-} |
-
genericLocator getGenericLocator |
- No |
- (String | Function) either a fixed locator string, or a function that returns a locator string. If a function, it should take no arguments. You may experience some slowdown when recording on pages where individual UI elements have many default locators (due to many permutations of default values over multiple arguments). This is because each default locator is potentially evaluated and matched against the interacted page element. This becomes especially problematic if several UI elements have this characteristic. By specifying a generic locator, you give the matching engine a chance to skip over UI elements that definitely don't match. The default locators for skipped elements will not be evaluated unless the generic locator matches the interacted page element.. |
- genericLocator: "//table[@class='ctrl']"
- + "/descendant::input"
- getGenericLocator: function() {
- return this._xpathPrefix + '/descendant::a';
-}
- |
-| getOffsetLocator |
- No |
- (Function) a function that returns an offset locator. The locator is offset from the element identified by a UI specifier string. The function should take this element, and the interacted page element, as arguments, and have the method signature getOffsetLocator(locatedElement, pageElement). If an offset locator can't be found, a value that evaluates to false must be returned. A convenient default function UIElement.defaultOffsetLocatorStrategy is provided so you don't have to define your own. It uses several typical strategies also employed by the IDE recording when recording normally. See the Advanced Topics section below for more information on offset locators. |
- getOffsetLocator: UIElement.defaultOffsetLocatorStrategy
- getOffsetLocator:
- function(locatedElement, pageElement) {
- if (pageElement.parentNode == locatedElement) {
- return '/child::' + pageElement.nodeName;
- }
- return null;
-} |
-
| testcase* |
- No |
- (Object) a testcase for testing the implementation of the getLocator() method. As many testcases as desired may be defined for each UI element. They must all start with the string "testcase". |
- testcase1: {
- xhtml: '<div class="item"><h5>'
- + '<a expected-result="1" /></h5></div>'
-}See section below elaborating on testcases. |
-
-| _* |
- No |
- (Any data type) a "local variable" declared for the UI element. This variable will be available both within the getLocator() method of the UI element, and any getDefaultValues() methods of the arguments via the this keyword. They must all start with an underscore "_". |
- _labelMap: {
- 'Name': 'user'
- , 'Email': 'em'
- , 'Phone': 'tel'
-} |
-
-
-
-UI-Argument Shorthand
-
-UI arguments are defined as part of UI elements, and help determine how an XPath is generated. A list of arguments may be defined within the UI element JSON shorthand. Here's an example of how that might look:
-
-
-map.addElement('searchPages', {
- name: 'result'
- , description: 'link to a result page'
- , args: [
- {
- name: 'index'
- , description: 'the index of the search result'
- , defaultValues: range(1, 21)
- }
- , {
- name: 'type'
- , description: 'the type of result page'
- , defaultValues: [ 'summary', 'detail' ]
- }
- ]
- , getLocator: function(args) {
- var index = args['index'];
- var type = args['type'];
- return "//div[@class='result'][" + index + "]"
- + "/descendant::a[@class='" + type + "']";
- }
-});
-
-
-In the above example, two arguments are defined, index and type. Metadata is provided to describe them, and default values are also specified. FInally, the getLocator() method is defined. The behavior of the method depends on the values of the arguments that are passed in.
-
-Default values come into play when recording tests using the Selenium IDE. When you interact with a page element in recording mode, the IDE uses all the locator strategies at its disposal to deduce an appropriate locator string for that element. UI-Element introduces a new ui locator strategy. When applying this strategy using a particular UI element, Selenium generates a list of XPaths to try by permuting the arguments of that UI element over all default values. Here, the default values { 1, 2, 3, 4 .. 20 } are given for the index argument using the special range() function, and the values { summary, detail } are given for the type argument in standard javascript array notation. If you don't intend to use the IDE, go ahead and set the default values to the empty array [].
-
-Here's a table containing information about the attributes of the UI argument object.
-
-
-| Name |
- Required? |
- Description |
- Example |
-
-| name |
- Yes |
- (String) the name of the argument. This will be the name of the property of the object passed into the parent UI element's getLocator() method containing the argument value. |
- name: 'index' |
-
-| description |
- Yes |
- (String) a description for the argument. |
- description: 'the index of the article' |
-
-defaultValues getDefaultValues() |
- Yes |
- (Array | Function) either an array of string or numerical values, or a function that returns an array of string or numerical values. One or the other should be defined, but not both. Under the sheets, the defaultValues attribute eventually gets transcripted as a getDefaultValues() function. The method signature of the function is getDefaultValues(inDocument). inDocument is the current document object of the page at time of recording. In cases where the default values are known a priori, inDocument need not be used. If the default values of all arguments of a UI element are known a priori, the list of default locators for the element may be precalculated, resulting in better performance. If inDocument is used, in cases where the current document is inspected for valid values, the element's default locators are calculated once for every recordable event. |
- defaultValues: [ 'alpha', 'beta', 'unlimited' ]
- getDefaultValues: function() {
- return keys(this._idMap);
-}
- getDefaultValues: function(inDocument) {
- var defaultValues = [];
- var links = inDocument
- .getElementsByTagName('a');
- for (var i = 0; i < links.length; ++i) {
- var link = links[i];
- if (link.className == 'category') {
- defaultValues.push(link.innerHTML);
- }
- }
- return defaultValues;
-} |
-
-
-
-About this
-
-You may have noticed usage of the this keyword in the examples above, specifically in the getLocator() and getDefaultValues() methods. Well, what exactly is this?
-
-The answer is: it depends. The object referred to by this changes depending on the context in which it is being evaluated. At the time of object creation using addPageset() or addElement(), it refers to the window object of the Selenium IDE, which isn't useful at all. However, subsequently any time getLocator() is called, its this references the UI element object it's attached too. Thus, using this, any "local variables" defined for the UI element may be accessed. Similarly, when getDefaultValues() is called, its this references the UI argument object it's attached too. But ... what "local variables" are accessible by the from getDefaultValues()?
-
-There's a little magic here. If you defined your local variables as prescribed in the above UI-Element Shorthand section, starting with an underscore, those variable are automatically made available to the UI argument via its this keyword. Note that this isn't standard javascript behavior. It's implemented this way to clear out clutter in the method definitions and to avoid the use of global variables for lists and maps used within the methods. It is sometimes useful, for example, to define an object that maps human-friendly argument values to DOM element id's. In such a case, getDefaultValues() can be made to simply return the keys() (or property names) of the map, while the getLocator() method uses the map to retrieve the associated id to involve in the locator.
-
-Also note that this only behaves this way in the two mentioned methods, getLocator() and getDefaultValues(); in other words you can't reference the UI element's local variables using this outside of methods.
-
-If you're interested, here's some additional reading on javascript scope.
-
-Advanced Topics
-
-Testcases
-
-You can write testcases for your UI element implementations that are run every time the Selenium IDE is started. Any testcases that fail are reported on. The dual purpose of writing testcases is to both validate the getLocator() method against a representation of the real page under test, and to give a visual example of what the DOM context of a page element is expected to be.
-
-A testcase is an object with a required xhtml property (String), and a required args property (Object). An example is due:
-
-
-testcase1: {
- args: { line: 2, column: 3 }
- , xhtml: '<table id="scorecard">'
- + '<tr class="line" />'
- + '<tr class="line"><td /><td /><td expected-result="1" /></tr>'
- + '</table>'
-}
-
-
-The args property specifies the object to be passed into the UI element's getLocator() method to generate the test locator, which is then applied to the xhtml. If evaluating the locator on the XHTML document returns a DOM node with the expected-result attribute, the testcase is considered to have passed.
-
-The xhtml property must represent a complete XML document, sans <html> tags, which are automatically added. The reason this is necessary is that the text is being converted into an XPath evaluable DOM tree via Mozilla's native XML parser. Unfortunately, there is no way to generate a simple HTML document, only XML documents. This means that the content of the xhtml must be well-formed. Tags should also be specified in lowercase.
-
-Fuzzy Matching
-
-Here's a real-world example of where fuzzy matching is important:
-
-
-<table>
-<tr onclick="showDetails(0)">
- <td>Brahms</td>
- <td>Viola Quintet</td>
-</tr>
-<tr onclick="showDetails(1)">
- <td>Saegusa</td>
- <td>Cello 88</td>
-</tr>
-</table>
-
-
-Imagine I'm recording in the IDE. Let's say I click on "Cello 88". The IDE would create locator for this action like //table/tr[2]/td[2]. Does that mean that my getLocator() method should return the same XPath?
-
-Clearly not. Clicking on either of the table cells for the second row has the same result. I would like my UI element generated XPath to be //table/tr[2] . However, when recording, the page element that was identified as being acted upon was the table cell, which doesn't match my UI element XPath, so the ui locator strategy will fail to auto-populate. What to do?
-
-Fuzzy matching to the rescue! Fuzzy matching is realized as a fuzzy matcher function that returns true if a target DOM element is considered to be equivalent to a reference DOM element. The reference DOM element would be the element specified by the UI element's generated XPath. Currently, the fuzzy matcher considers it a match if:
-
-
-- the elements are the same element,
-- the reference element is an anchor (
<a>) element, and the target element is a descendant of it; or
-- the reference element has an
onclick attribute, and the target element is a descendant of it.
-
-
-This logic may or may not be sufficient for you. The good news is, it's very easy to modify. Look for the definition of BrowserBot.prototype.locateElementByUIElement.is_fuzzy_match in ui-element.js .
-
-Offset Locators
-
-Offset locators are locators that are appended to UI specifier strings to form composite locators. They can be automatically deduced by the IDE recorder for UI elements that have specified a getOffsetLocator function. This feature may be useful if your pages contain too many elements to write UI elements for. In this case, offset locators allow you to define UI elements that "anchor" other elements. Given the following markup:
-
-<form name="contact_info">
- <input type="text" name="foo" />
- <textarea name="bar"></textarea>
- <input type="submit" value="baz" />
-</form>
-
-Assume that a UI element has been defined for the form element. Then the following locators containing offset locators and "anchored" off this element would be recorded using the default offset locator function (UIElement.defaultOffsetLocatorStrategy):
-
-ui=contactPages::contact_form()->//input[@name='foo']
-ui=contactPages::contact_form()->//textarea[@name='bar']
-ui=contactPages::contact_form()->//input[@value='baz']
-
-The character sequence -> serves to delimit the offset locator from the main locator. For this reason, the sequence should not appear in the main locator, or else ambiguity will result.
-
-When recording with the IDE, no preference is given to matching plain vanilla UI specifier strings over ones that have offset locators. In other words, if a page element could be specified both by a UI specifier string for one UI element, and by one augmented by an offset locator for a different UI element, there is no guarantee that one or the other locator will be recorded.
-
-Currently, only XPath is supported as an offset locator type, as it is the only locator for which a context node can be specified at evaluation time. Other locator strategies may be supported in the future.
-
-Rollup Rules
-
-Question: Why use rollup rules? Answer: Remember the testcase from the "Getting Motivated" section above? With rollups, that testcase can be condensed into this:
-
-
-<tr>
- <td>open</td>
- <td>/</td>
- <td></td>
-</tr>
-<tr>
- <td>rollup</td>
- <td>navigate_to_subtopic_article</td>
- <td>index=2, subtopic=Creativity</td>
-</tr>
-
-
-It's inevitable that certain sequences of Selenium commands will appear in testcases over and over again. When this happens, you might wish to group several fine-grained commands into a single coarser, more semantically meaningful action. In doing so, you would abstract out the execution details for the action, such that if they were to change at some point, you would have a single point of update. In UI-Element, such actions are given their own command, called rollup. In a sense, rollups are a natural extension of the ui locator.
-
-UI-Element is designed with the belief that the IDE can be a useful tool for writing testcases, and need not be shunned for lack of functionality. A corollary belief is that you should be able to drive your RC test in the language of your choice. The execution of the rollup command by the Selenium testrunner produces the component commands, which are executed in a new context, like a function call. The logic of the rollup "expansion" is written in javascript. Corresponding logic for inferring a rollup from a list of commands is also written in javascript. Thus, the logic can be incorporated into any of the family of Selenium products as a user extension. Most notably, the IDE is made viable as a testcase creation tool that understands both how rollups expand to commands, and also how rollup rules can be "applied" to commands to reduce them to rollups.
-
-Rollup rule definitions appear in this general format:
-
-
-var manager = new RollupManager();
-
-manager.addRollupRule({ ... });
-manager.addRollupRule({ ... });
-...
-
-
-In a relatively simple form, a rollup rule looks like this:
-
-
-manager.addRollupRule({
- name: 'do_search'
- , description: 'performs a search'
- , args: [
- name: 'term'
- , description: 'the search term'
- ]
- , commandMatchers: [
- {
- command: 'type'
- , target: 'ui=searchPages::search_box\\(.+'
- , updateArgs: function(command, args) {
- var uiSpecifier = new UISpecifier(command.target);
- args.term = uiSpecifier.args.term;
- return args;
- }
- }
- , {
- command: 'click.+'
- , target: 'ui=searchPages::search_go\\(.+'
- }
- ]
- , getExpandedCommands: function(args) {
- var commands = [];
- var uiSpecifier = new UISpecifier(
- 'searchPages'
- , 'search_box'
- , { term: args.term });
- commands.push({
- command: 'type'
- , target: 'ui=' + uiSpecifier.toString()
- });
- commands.push({
- command: 'clickAndWait'
- , target: 'ui=searchPages::search_go()'
- });
- return commands;
- }
-});
-
-
-In the above example, a rollup rule is defined for performing a search. The rule can be "applied" to two consecutive commands that match the commandMatchers. The rollup takes one argument, term, and expands back to the original two commands. One thing to note is that the second command matcher will match all commands starting with click. The rollup will expand that command to a clickAndWait.
-
-Here's a table containing information about the attributes of the rollup rule object.
-
-
-| Name |
- Required? |
- Description |
- Example |
-
-| name |
- Yes |
- (String) the name of the rollup rule. This will be the target of the resulting rollup command. |
- name: 'do_login' |
-
-| description |
- Yes |
- (String) a description for the rollup rule. |
- description: 'logs into the application' |
-
-| alternateCommand |
- No |
- (String) specifies an alternate usage of rollup rules to replace commands. This string is used to replace the command name of the first matched command. |
- alternateCommand: 'clickAndWait' |
-
-| pre |
- No |
- (String) a detailed summary of the preconditions that must be satisfied for the rollup to execute successfully. This metadata is easily viewable in the IDE when the rollup command is selected. |
- pre: 'the page contains login widgets' |
-
-| post |
- No |
- (String) a detailed summary of the postconditions that will exist after the rollup has been executed. |
- post: 'the user is logged in, or is \
-directed to a login error page' |
-
-| args |
- Conditional |
- (Array) a list of arguments that are used to modify the rollup expansion. These are similar to UI arguments, with the exception that exampleValues are provided, instead of defaultValues. Here, example values are used for reference purposes only; they are displayed in the rollup pane in the IDE. This attribute may be omitted if no updateArgs() functions are defined for any command matchers. |
- args: {
- name: 'user'
- , description: 'the username to login as'
- , exampleValues: [
- 'John Doe'
- , 'Jane Doe'
- ]
-} |
-
-commandMatchers getRollup() |
- Yes |
- (Array | Function) a list of command matcher definitions, or a function that, given a list of commands, returns either 1) a rollup command if the rule is considered to match the commands (starting at the first command); or 2) false. If a function, it should have the method signature getRollup(commands), and the returned rollup command (if any) must have the replacementIndexes attribute, which is a list of array indexes indicating which commands in the commands parameter are to be replaced.
- If you don't intend on using the IDE with your rollups, go ahead and set this to the empty array []. |
- commandMatchers: [
- {
- command: 'type'
- , target: 'ui=loginPages::user\\(.+'
- , value: '.+'
- , minMatches: 1
- , maxMatches: 1
- , updateArgs:
- function(command, args) {
- args.user = command.value;
- return args;
- }
- }
-]
- // this is a simplistic example, roughy
-// equivalent to the commandMatchers
-// example above. The to_kwargs() function
-// is used to turn an arguments object into
-// a keyword-arguments string.
-getRollup: function(commands) {
- var command = commands[0];
- var re = /^ui=loginPages::user\(.+/;
- if (command.command == 'type' &&
- re.test(command.target) &&
- command.value) {
- var args = { user: command.value };
- return {
- command: 'rollup'
- , target: this.name
- , value: to_kwargs(args)
- , replacementIndexes: [ 0 ]
- };
- }
- return false;
-}See section below elaborating on command matcher objects. |
-
-expandedCommands getExpandedCommands() |
- Yes |
- (Array | Function) a list of commands the rollup command expands into, or a function that, given an argument object mapping argument names to values, returns a list of expanded commands. If a function, it should have the method signature getExpandedCommands(args). Each command in the list of expanded commands should contain a command attribute, which is the name of the command, and optionally target and value attributes, depending on the type of command. It is expected that providing a fixed list of expanded commands will be of limited use, as rollups will typically contain commands that have arguments, requiring more sophisticated logic to expand. |
- expandedCommands: [
- {
- command: 'check'
- , target: 'ui=termsPages::agree\\(.+'
- }
- , {
- command: 'clickAndWait'
- , target: 'ui=termsPages::submit\\(.+'
- }
-]
- getExpandedCommands: function(args) {
- var commands = [];
- commands.push({
- command: 'type'
- , target: 'ui=loginPages::user()'
- , value: args.user
- });
- commands.push({
- command: 'type'
- , target: 'ui=loginPages::pass()'
- , value: args.pass
- });
- commands.push({
- command: 'clickAndWait'
- , target: 'ui=loginPages::submit()'
- });
- commands.push({
- command: 'verifyLocation'
- , target: 'regexp:.+/home'
- });
- return commands;
-}
- // if using alternateCommand
-expandedCommands: []
- |
-
-
-
-The user should be able to freely record commands in the IDE, which can be collapsed into rollups at any point by applying the defined rollup rules. Healthy usage of the ui locator makes commands easy to match using command matcher definitions. Command matchers simplify the specification of a command match. In basic usage, for a rollup rule, you might specify 3 command matchers: M1, M2, and M3, that you intend to match 3 corresponding commands, C1, C2, and C3. In more complex usage, a single command matcher might match more than one command. For example, M1 matches C1 and C2, M2 matches C3, and M3 matches C4, C5, and C6. In the latter case, you would want to track the matches by updating argument values in the command matchers' updateArgs() methods.
-
-Here are the required and optional fields for command matcher objects:
-
-
-| Name |
- Required? |
- Description |
- Example |
-
-| command |
- Yes |
- (String) a simplified regular expression string that matches the command name of a command. The special regexp characters ^ and $ are automatically included at the beginning and end of the string, and therefore should not be explicitly provided. |
- command: 'click.+'
- command: 'rollup' |
-
-| target |
- Yes |
- (String) a simplified regular expression string that matches the target of a command. Same rules as for the command attribute. |
- target: 'btnG'
- // special regexp characters must be
-// escaped in regexp strings. Backslashes
-// always need to be escaped in javascript
-// strings.
-target: 'ui=loginPages::user\\(.+'
- |
-
-| value |
- No |
- (String) a simplified regular expression string that matches the value of a command. Same rules as for the command attribute. |
- value: '\\d+'
- value: (?:foo|bar) |
-
-| minMatches |
- No |
- (Number) the minimum number of times this command matcher must match consecutive commands for the rollup rule to match a set of commands. If unspecified, the default is 1. If maxMatches is also specified, minMatches must be less than or equal to it. |
- minMatches: 2 |
-
-| maxMatches |
- No |
- (Number) the maximum number of times this command matcher is allowed to match consecutive commands for the rollup rule. If unspecified, the default is 1. |
- maxMatches: 2 |
-
-| updateArgs() |
- No |
- (Function) updates an arguments object when a match has been found, and returns the updated arguments object. This method is used to keep track of the way in which one or more commands were matched. When a rollup rule is successfully applied, any argument name-value pairs are stored as the rollup command's value. At time of expanding the rollup command, the command's value is converted back to an arguments object, which is passed to the rollup rule's getExpandedCommands() method. This method must have the following method signature: updateArgs(command, args), where command is the command object that was just matched, and args is the arguments object for the current trial application of the parent rollup rule. |
- // reused from above
-updateArgs: function(command, args) {
- args.user = command.value;
- return args;
-}
- // for multiple matches
-updateArgs: function(command, args) {
- if (!args.clickCount) {
- args.clickCount = 0;
- }
- ++args.clickCount;
- return args;
-}
- // another example from above (modified).
-// If you need to parse a UI specifier,
-// instantiate a new UISpecifier object with the
-// locator. To do it by the book, you should
-// first strip off the "ui=" prefix. If you just
-// want to inspect the UI specifier's args, you
-// can safely skip this step.
-updateArgs: function(command, args) {
- var s = command.target.replace(/^ui=/, '');
- var uiSpecifier = new UISpecifier(s);
- args.term = uiSpecifier.args.term;
- return args;
-}
- // example from sample map file. If you're
-// matching a rollup command that has arguments,
-// you'll want to parse them. The easiest way
-// to do this is with the parse_kwargs()
-// function, which has its roots in python.
-updateArgs: function(command, args) {
- var args1 = parse_kwargs(command.value);
- args.subtopic = args1.subtopic;
- return args;
-} |
-
-
-
-Too much mumbo jumbo?
-
-To see rollup rules in action in the IDE, use the included sample map with UI-Element (see instructions above in the "Including the Right Files" section), and grab the listing of 4 commands from the "Getting Motivated" section, above. Under the Source tab of the IDE, paste the commands in between the <tbody> and </tbody> tags. Now switch back to the Table tab, and click the new purple spiral button; this is the "Apply rollup rules" button. If done correctly, you should be prompted when rollup rule matches are found. Go ahead - go to the alistapart.com site and try executing the rollups!
-
-Release Notes
-
-Core-1.0
-
-
-- UI-Element is now completely integrated into Selenium Core.
-- Added offset locators. Modified the delimiter to be
->.
-getDefaultValues() can dynamically construct a list of values and assume that a document object is being passed in.
-- Arguments in UI specifier strings are presented in the same order as they are defined in the mapping file (no longer alphabetically).
-- Allow generic locators to be specified, potentially improving recording performance when there are many UI arguments.
-- Updated documentation.
-- Many other fixes.
-
-
-ui0.7
-
-
-- Changed extensions id and homepage to avoid conflicting with standard Selenium IDE distribution.
-- Added rollup button.
-- Added UI-Element and Rollup panes, with beautiful colors and formatting.
-- Updated referenced version of Selenium Core to 0.8.3, and RC to 0.9.2 .
-- Added
quoteForXPath() to String prototype.
-- Made XPath uppercasing much more robust. It is now backed by the ajaxslt library. Uppercasing is no longer required by UI-Element. It is used to demonstrate how XPath transformations may be used to improve XPath evaluation performance when using the javascript engine. See this thread on XPath performance.
-
- Added new
rollup Selenium command and associated functionality with the RollupManager object.
-- Deprecated
getXPath() and xpath in favor of getLocator() and locator in the UI-Element shorthand. Testcases now work with locator types other than XPath (implicit, CSS, etc.).
-- UI element testcases are now truly XHTML. All content is considered inner HTML of the html element, which is automatically generated. This supports the use of alternate locator types described in the above bullet.
-- Global variables introduced by UI-Element are now properties of the variable
GLOBAL. You can now name your map uiMap if you wish.
-- Updated the sample map, including demonstration of implicit and CSS locators, Rollup Rules, and usage of
quoteForXPath().
-- Improved auto-population of target dropdown with UI element locators and rollup names. The population logic is as follows: when a command is loaded from a file or inserted without having been recorded, all UI element locators are shown. After a command recorded or executed, only UI element locators for pagesets that match the page at time of recording or execution will be shown.
-- Made UI element testcase args mandatory. This reduces the startup time for the IDE, and improves testcase readability.
-- Updated documentation. Added this release notes section.
-
-
-Final Thoughts
-
-Catch UI-Element news in the Selenium category of my blog. You can also find me on the OpenQA Forums.
-
-- Haw-Bin Chai
-
-
-
diff --git a/vendor/plugins/selenium-on-rails/selenium-core/scripts/ui-element.js b/vendor/plugins/selenium-on-rails/selenium-core/scripts/ui-element.js
deleted file mode 100644
index 58709ce0..00000000
--- a/vendor/plugins/selenium-on-rails/selenium-core/scripts/ui-element.js
+++ /dev/null
@@ -1,1537 +0,0 @@
-//******************************************************************************
-// Globals, including constants
-
-var UI_GLOBAL = {
- UI_PREFIX: 'ui'
- , XHTML_DOCTYPE: ''
- , XHTML_XMLNS: 'http://www.w3.org/1999/xhtml'
-};
-
-//*****************************************************************************
-// Exceptions
-
-function UIElementException(message)
-{
- this.message = message;
- this.name = 'UIElementException';
-}
-
-function UIArgumentException(message)
-{
- this.message = message;
- this.name = 'UIArgumentException';
-}
-
-function PagesetException(message)
-{
- this.message = message;
- this.name = 'PagesetException';
-}
-
-function UISpecifierException(message)
-{
- this.message = message;
- this.name = 'UISpecifierException';
-}
-
-function CommandMatcherException(message)
-{
- this.message = message;
- this.name = 'CommandMatcherException';
-}
-
-//*****************************************************************************
-// UI-Element core
-
-/**
- * The UIElement object. This has been crafted along with UIMap to make
- * specifying UI elements using JSON as simple as possible. Object construction
- * will fail if 1) a proper name isn't provided, 2) a faulty args argument is
- * given, or 3) getLocator() returns undefined for a valid permutation of
- * default argument values. See ui-doc.html for the documentation on the
- * builder syntax.
- *
- * @param uiElementShorthand an object whose contents conform to the
- * UI-Element builder syntax.
- *
- * @return a new UIElement object
- * @throws UIElementException
- */
-function UIElement(uiElementShorthand)
-{
- // a shorthand object might look like:
- //
- // {
- // name: 'topic'
- // , description: 'sidebar links to topic categories'
- // , args: [
- // {
- // name: 'name'
- // , description: 'the name of the topic'
- // , defaultValues: topLevelTopics
- // }
- // ]
- // , getLocator: function(args) {
- // return this._listXPath +
- // "/a[text()=" + args.name.quoteForXPath() + "]";
- // }
- // , getGenericLocator: function() {
- // return this._listXPath + '/a';
- // }
- // // maintain testcases for getLocator()
- // , testcase1: {
- // // defaultValues used if args not specified
- // args: { name: 'foo' }
- // , xhtml: ''
- // }
- // // set a local element variable
- // , _listXPath: "//div[@id='topiclist']/ul/li"
- // }
- //
- // name cannot be null or an empty string. Enforce the same requirement for
- // the description.
-
- /**
- * Recursively returns all permutations of argument-value pairs, given
- * a list of argument definitions. Each argument definition will have
- * a set of default values to use in generating said pairs. If an argument
- * has no default values defined, it will not be included among the
- * permutations.
- *
- * @param args a list of UIArguments
- * @param opt_inDocument (optional)
- * @return a list of associative arrays containing key value pairs
- */
- this.permuteArgs = function(args, opt_inDocument) {
- var permutations = [];
- for (var i = 0; i < args.length; ++i) {
- var arg = args[i];
- var defaultValues = (arguments.length > 1)
- ? arg.getDefaultValues(opt_inDocument)
- : arg.getDefaultValues();
-
- // skip arguments for which no default values are defined
- if (defaultValues.length == 0) {
- continue;
- }
- for (var j = 0; j < defaultValues.length; ++j) {
- var value = defaultValues[j];
- var nextPermutations = this.permuteArgs(args.slice(i+1));
- if (nextPermutations.length == 0) {
- var permutation = {};
- permutation[arg.name] = value + ''; // make into string
- permutations.push(permutation);
- }
- else {
- for (var k = 0; k < nextPermutations.length; ++k) {
- nextPermutations[k][arg.name] = value + '';
- permutations.push(nextPermutations[k]);
- }
- }
- }
- break;
- }
- return permutations;
- }
-
-
-
- /**
- * Returns a list of all testcases for this UIElement.
- */
- this.getTestcases = function()
- {
- return this.testcases;
- }
-
-
-
- /**
- * Run all unit tests, stopping at the first failure, if any. Return true
- * if no failures encountered, false otherwise. See the following thread
- * regarding use of getElementById() on XML documents created by parsing
- * text via the DOMParser:
- *
- * http://groups.google.com/group/comp.lang.javascript/browse_thread/thread/2b1b82b3c53a1282/
- */
- this.test = function()
- {
- var parser = new DOMParser();
- var testcases = this.getTestcases();
- testcaseLoop: for (var i = 0; i < testcases.length; ++i) {
- var testcase = testcases[i];
- var xhtml = UI_GLOBAL.XHTML_DOCTYPE + '' + testcase.xhtml + '';
- var doc = parser.parseFromString(xhtml, "text/xml");
- if (doc.firstChild.nodeName == 'parsererror') {
- safe_alert('Error parsing XHTML in testcase "' + testcase.name
- + '" for UI element "' + this.name + '": ' + "\n"
- + doc.firstChild.firstChild.nodeValue);
- }
-
- // we're no longer using the default locators when testing, because
- // args is now required
- var locator = parse_locator(this.getLocator(testcase.args));
- var results;
- if (locator.type == 'xpath' || (locator.type == 'implicit' &&
- locator.string.substring(0, 2) == '//')) {
- // try using the javascript xpath engine to avoid namespace
- // issues. The xpath does have to be lowercase however, it
- // seems.
- results = eval_xpath(locator.string, doc,
- { allowNativeXpath: false, returnOnFirstMatch: true });
- }
- else {
- // piece the locator back together
- locator = (locator.type == 'implicit')
- ? locator.string
- : locator.type + '=' + locator.string;
- results = eval_locator(locator, doc);
- }
- if (results.length && results[0].hasAttribute('expected-result')) {
- continue testcaseLoop;
- }
-
- // testcase failed
- if (is_IDE()) {
- var msg = 'Testcase "' + testcase.name
- + '" failed for UI element "' + this.name + '":';
- if (!results.length) {
- msg += '\n"' + locator + '" did not match any elements!';
- }
- else {
- msg += '\n' + results[0] + ' was not the expected result!';
- }
- safe_alert(msg);
- }
- return false;
- }
- return true;
- };
-
-
-
- /**
- * Creates a set of locators using permutations of default values for
- * arguments used in the locator construction. The set is returned as an
- * object mapping locators to key-value arguments objects containing the
- * values passed to getLocator() to create the locator.
- *
- * @param opt_inDocument (optional) the document object of the "current"
- * page when this method is invoked. Some arguments
- * may have default value lists that are calculated
- * based on the contents of the page.
- *
- * @return a list of locator strings
- * @throws UIElementException
- */
- this.getDefaultLocators = function(opt_inDocument) {
- var defaultLocators = {};
- if (this.args.length == 0) {
- defaultLocators[this.getLocator({})] = {};
- }
- else {
- var permutations = this.permuteArgs(this.args, opt_inDocument);
- if (permutations.length != 0) {
- for (var i = 0; i < permutations.length; ++i) {
- var args = permutations[i];
- var locator = this.getLocator(args);
- if (!locator) {
- throw new UIElementException('Error in UIElement(): '
- + 'no getLocator return value for element "' + name
- + '"');
- }
- defaultLocators[locator] = args;
- }
- }
- else {
- // try using no arguments. If it doesn't work, fine.
- try {
- var locator = this.getLocator();
- defaultLocators[locator] = {};
- }
- catch (e) {
- safe_log('debug', e.message);
- }
- }
- }
- return defaultLocators;
- };
-
-
-
- /**
- * Validate the structure of the shorthand notation this object is being
- * initialized with. Throws an exception if there's a validation error.
- *
- * @param uiElementShorthand
- *
- * @throws UIElementException
- */
- this.validate = function(uiElementShorthand)
- {
- var msg = "UIElement validation error:\n" + print_r(uiElementShorthand);
- if (!uiElementShorthand.name) {
- throw new UIElementException(msg + 'no name specified!');
- }
- if (!uiElementShorthand.description) {
- throw new UIElementException(msg + 'no description specified!');
- }
- if (!uiElementShorthand.locator
- && !uiElementShorthand.getLocator
- && !uiElementShorthand.xpath
- && !uiElementShorthand.getXPath) {
- throw new UIElementException(msg + 'no locator specified!');
- }
- };
-
-
-
- this.init = function(uiElementShorthand)
- {
- this.validate(uiElementShorthand);
-
- this.name = uiElementShorthand.name;
- this.description = uiElementShorthand.description;
-
- // construct a new getLocator() method based on the locator property,
- // or use the provided function. We're deprecating the xpath property
- // and getXPath() function, but still allow for them for backwards
- // compatability.
- if (uiElementShorthand.locator) {
- this.getLocator = function(args) {
- return uiElementShorthand.locator;
- };
- }
- else if (uiElementShorthand.getLocator) {
- this.getLocator = uiElementShorthand.getLocator;
- }
- else if (uiElementShorthand.xpath) {
- this.getLocator = function(args) {
- return uiElementShorthand.xpath;
- };
- }
- else {
- this.getLocator = uiElementShorthand.getXPath;
- }
-
- if (uiElementShorthand.genericLocator) {
- this.getGenericLocator = function() {
- return uiElementShorthand.genericLocator;
- };
- }
- else if (uiElementShorthand.getGenericLocator) {
- this.getGenericLocator = uiElementShorthand.getGenericLocator;
- }
-
- if (uiElementShorthand.getOffsetLocator) {
- this.getOffsetLocator = uiElementShorthand.getOffsetLocator;
- }
-
- // get the testcases and local variables
- this.testcases = [];
- var localVars = {};
- for (var attr in uiElementShorthand) {
- if (attr.match(/^testcase/)) {
- var testcase = uiElementShorthand[attr];
- if (uiElementShorthand.args &&
- uiElementShorthand.args.length && !testcase.args) {
- safe_alert('No args defined in ' + attr + ' for UI element '
- + this.name + '! Skipping testcase.');
- continue;
- }
- testcase.name = attr;
- this.testcases.push(testcase);
- }
- else if (attr.match(/^_/)) {
- this[attr] = uiElementShorthand[attr];
- localVars[attr] = uiElementShorthand[attr];
- }
- }
-
- // create the arguments
- this.args = []
- this.argsOrder = [];
- if (uiElementShorthand.args) {
- for (var i = 0; i < uiElementShorthand.args.length; ++i) {
- var arg = new UIArgument(uiElementShorthand.args[i], localVars);
- this.args.push(arg);
- this.argsOrder.push(arg.name);
-
- // if an exception is thrown when invoking getDefaultValues()
- // with no parameters passed in, assume the method requires an
- // inDocument parameter, and thus may only be invoked at run
- // time. Mark the UI element object accordingly.
- try {
- arg.getDefaultValues();
- }
- catch (e) {
- this.isDefaultLocatorConstructionDeferred = true;
- }
- }
-
- }
-
- if (!this.isDefaultLocatorConstructionDeferred) {
- this.defaultLocators = this.getDefaultLocators();
- }
- };
-
-
-
- this.init(uiElementShorthand);
-}
-
-// hang this off the UIElement "namespace"
-UIElement.defaultOffsetLocatorStrategy = function(locatedElement, pageElement) {
- if (is_ancestor(locatedElement, pageElement)) {
- var offsetLocator;
- var recorder = Recorder.get(locatedElement.ownerDocument.defaultView);
- var builderNames = [
- 'xpath:link'
- , 'xpath:img'
- , 'xpath:attributes'
- , 'xpath:idRelative'
- , 'xpath:href'
- , 'xpath:position'
- ];
- for (var i = 0; i < builderNames.length; ++i) {
- offsetLocator = recorder.locatorBuilders
- .buildWith(builderNames[i], pageElement, locatedElement);
- if (offsetLocator) {
- return offsetLocator;
- }
- }
- }
- return null;
-};
-
-
-
-/**
- * Constructs a UIArgument. This is mostly for checking that the values are
- * valid.
- *
- * @param uiArgumentShorthand
- * @param localVars
- *
- * @throws UIArgumentException
- */
-function UIArgument(uiArgumentShorthand, localVars)
-{
- /**
- * @param uiArgumentShorthand
- *
- * @throws UIArgumentException
- */
- this.validate = function(uiArgumentShorthand)
- {
- var msg = "UIArgument validation error:\n"
- + print_r(uiArgumentShorthand);
-
- // try really hard to throw an exception!
- if (!uiArgumentShorthand.name) {
- throw new UIArgumentException(msg + 'no name specified!');
- }
- if (!uiArgumentShorthand.description) {
- throw new UIArgumentException(msg + 'no description specified!');
- }
- if (!uiArgumentShorthand.defaultValues &&
- !uiArgumentShorthand.getDefaultValues) {
- throw new UIArgumentException(msg + 'no default values specified!');
- }
- };
-
-
-
- /**
- * @param uiArgumentShorthand
- * @param localVars a list of local variables
- */
- this.init = function(uiArgumentShorthand, localVars)
- {
- this.validate(uiArgumentShorthand);
-
- this.name = uiArgumentShorthand.name;
- this.description = uiArgumentShorthand.description;
-
- if (uiArgumentShorthand.defaultValues) {
- var defaultValues = uiArgumentShorthand.defaultValues;
- this.getDefaultValues =
- function() { return defaultValues; }
- }
- else {
- this.getDefaultValues = uiArgumentShorthand.getDefaultValues;
- }
-
- for (var name in localVars) {
- this[name] = localVars[name];
- }
- }
-
-
-
- this.init(uiArgumentShorthand, localVars);
-}
-
-
-
-/**
- * The UISpecifier constructor is overloaded. If less than three arguments are
- * provided, the first argument will be considered a UI specifier string, and
- * will be split out accordingly. Otherwise, the first argument will be
- * considered the path.
- *
- * @param uiSpecifierStringOrPagesetName a UI specifier string, or the pageset
- * name of the UI specifier
- * @param elementName the name of the element
- * @param args an object associating keys to values
- *
- * @return new UISpecifier object
- */
-function UISpecifier(uiSpecifierStringOrPagesetName, elementName, args)
-{
- /**
- * Initializes this object from a UI specifier string of the form:
- *
- * pagesetName::elementName(arg1=value1, arg2=value2, ...)
- *
- * into its component parts, and returns them as an object.
- *
- * @return an object containing the components of the UI specifier
- * @throws UISpecifierException
- */
- this._initFromUISpecifierString = function(uiSpecifierString) {
- var matches = /^(.*)::([^\(]+)\((.*)\)$/.exec(uiSpecifierString);
- if (matches == null) {
- throw new UISpecifierException('Error in '
- + 'UISpecifier._initFromUISpecifierString(): "'
- + this.string + '" is not a valid UI specifier string');
- }
- this.pagesetName = matches[1];
- this.elementName = matches[2];
- this.args = (matches[3]) ? parse_kwargs(matches[3]) : {};
- };
-
-
-
- /**
- * Override the toString() method to return the UI specifier string when
- * evaluated in a string context. Combines the UI specifier components into
- * a canonical UI specifier string and returns it.
- *
- * @return a UI specifier string
- */
- this.toString = function() {
- // empty string is acceptable for the path, but it must be defined
- if (this.pagesetName == undefined) {
- throw new UISpecifierException('Error in UISpecifier.toString(): "'
- + this.pagesetName + '" is not a valid UI specifier pageset '
- + 'name');
- }
- if (!this.elementName) {
- throw new UISpecifierException('Error in UISpecifier.unparse(): "'
- + this.elementName + '" is not a valid UI specifier element '
- + 'name');
- }
- if (!this.args) {
- throw new UISpecifierException('Error in UISpecifier.unparse(): "'
- + this.args + '" are not valid UI specifier args');
- }
-
- uiElement = UIMap.getInstance()
- .getUIElement(this.pagesetName, this.elementName);
- if (uiElement != null) {
- var kwargs = to_kwargs(this.args, uiElement.argsOrder);
- }
- else {
- // probably under unit test
- var kwargs = to_kwargs(this.args);
- }
- return this.pagesetName + '::' + this.elementName + '(' + kwargs + ')';
- };
-
-
-
- // construct the object
- if (arguments.length < 2) {
- this._initFromUISpecifierString(uiSpecifierStringOrPagesetName);
- }
- else {
- this.pagesetName = uiSpecifierStringOrPagesetName;
- this.elementName = elementName;
- this.args = (args) ? clone(args) : {};
- }
-}
-
-
-
-function Pageset(pagesetShorthand)
-{
- /**
- * Returns true if the page is included in this pageset, false otherwise.
- * The page is specified by a document object.
- *
- * @param inDocument the document object representing the page
- */
- this.contains = function(inDocument)
- {
- var urlParts = parseUri(unescape(inDocument.location.href));
- var path = urlParts.path
- .replace(/^\//, "")
- .replace(/\/$/, "");
- if (!this.pathRegexp.test(path)) {
- return false;
- }
- for (var paramName in this.paramRegexps) {
- var paramRegexp = this.paramRegexps[paramName];
- if (!paramRegexp.test(urlParts.queryKey[paramName])) {
- return false;
- }
- }
- if (!this.pageContent(inDocument)) {
- return false;
- }
-
- return true;
- }
-
-
-
- this.getUIElements = function()
- {
- var uiElements = [];
- for (var uiElementName in this.uiElements) {
- uiElements.push(this.uiElements[uiElementName]);
- }
- return uiElements;
- };
-
-
-
- /**
- * Returns a list of UI specifier string stubs representing all UI elements
- * for this pageset. Stubs contain all required arguments, but leave
- * argument values blank. Each element stub is paired with the element's
- * description.
- *
- * @return a list of UI specifier string stubs
- */
- this.getUISpecifierStringStubs = function()
- {
- var stubs = [];
- for (var name in this.uiElements) {
- var uiElement = this.uiElements[name];
- var args = {};
- for (var i = 0; i < uiElement.args.length; ++i) {
- args[uiElement.args[i].name] = '';
- }
- var uiSpecifier = new UISpecifier(this.name, uiElement.name, args);
- stubs.push([
- UI_GLOBAL.UI_PREFIX + '=' + uiSpecifier.toString()
- , uiElement.description
- ]);
- }
- return stubs;
- }
-
-
-
- /**
- * Throws an exception on validation failure.
- */
- this._validate = function(pagesetShorthand)
- {
- var msg = "Pageset validation error:\n"
- + print_r(pagesetShorthand);
- if (!pagesetShorthand.name) {
- throw new PagesetException(msg + 'no name specified!');
- }
- if (!pagesetShorthand.description) {
- throw new PagesetException(msg + 'no description specified!');
- }
- if (!pagesetShorthand.paths &&
- !pagesetShorthand.pathRegexp &&
- !pagesetShorthand.pageContent) {
- throw new PagesetException(msg
- + 'no path, pathRegexp, or pageContent specified!');
- }
- };
-
-
-
- this.init = function(pagesetShorthand)
- {
- this._validate(pagesetShorthand);
-
- this.name = pagesetShorthand.name;
- this.description = pagesetShorthand.description;
-
- var pathPrefixRegexp = pagesetShorthand.pathPrefix
- ? RegExp.escape(pagesetShorthand.pathPrefix) : "";
- var pathRegexp = '^' + pathPrefixRegexp;
-
- if (pagesetShorthand.paths != undefined) {
- pathRegexp += '(?:';
- for (var i = 0; i < pagesetShorthand.paths.length; ++i) {
- if (i > 0) {
- pathRegexp += '|';
- }
- pathRegexp += RegExp.escape(pagesetShorthand.paths[i]);
- }
- pathRegexp += ')$';
- }
- else if (pagesetShorthand.pathRegexp) {
- pathRegexp += '(?:' + pagesetShorthand.pathRegexp + ')$';
- }
-
- this.pathRegexp = new RegExp(pathRegexp);
- this.paramRegexps = {};
- for (var paramName in pagesetShorthand.paramRegexps) {
- this.paramRegexps[paramName] =
- new RegExp(pagesetShorthand.paramRegexps[paramName]);
- }
- this.pageContent = pagesetShorthand.pageContent ||
- function() { return true; };
- this.uiElements = {};
- };
-
-
-
- this.init(pagesetShorthand);
-}
-
-
-
-/**
- * Construct the UI map object, and return it. Once the object is instantiated,
- * it binds to a global variable and will not leave scope.
- *
- * @return new UIMap object
- */
-function UIMap()
-{
- // the singleton pattern, split into two parts so that "new" can still
- // be used, in addition to "getInstance()"
- UIMap.self = this;
-
- // need to attach variables directly to the Editor object in order for them
- // to be in scope for Editor methods
- if (is_IDE()) {
- Editor.uiMap = this;
- Editor.UI_PREFIX = UI_GLOBAL.UI_PREFIX;
- }
-
- this.pagesets = new Object();
-
-
-
- /**
- * pageset[pagesetName]
- * regexp
- * elements[elementName]
- * UIElement
- */
- this.addPageset = function(pagesetShorthand)
- {
- try {
- var pageset = new Pageset(pagesetShorthand);
- }
- catch (e) {
- safe_alert("Could not create pageset from shorthand:\n"
- + print_r(pagesetShorthand) + "\n" + e.message);
- return false;
- }
-
- if (this.pagesets[pageset.name]) {
- safe_alert('Could not add pageset "' + pageset.name
- + '": a pageset with that name already exists!');
- return false;
- }
-
- this.pagesets[pageset.name] = pageset;
- return true;
- };
-
-
-
- /**
- * @param pagesetName
- * @param uiElementShorthand a representation of a UIElement object in
- * shorthand JSON.
- */
- this.addElement = function(pagesetName, uiElementShorthand)
- {
- try {
- var uiElement = new UIElement(uiElementShorthand);
- }
- catch (e) {
- safe_alert("Could not create UI element from shorthand:\n"
- + print_r(uiElementShorthand) + "\n" + e.message);
- return false;
- }
-
- // run the element's unit tests only for the IDE, and only when the
- // IDE is starting. Make a rough guess as to the latter condition.
- if (is_IDE() && !editor.selDebugger && !uiElement.test()) {
- safe_alert('Could not add UI element "' + uiElement.name
- + '": failed testcases!');
- return false;
- }
-
- try {
- this.pagesets[pagesetName].uiElements[uiElement.name] = uiElement;
- }
- catch (e) {
- safe_alert("Could not add UI element '" + uiElement.name
- + "' to pageset '" + pagesetName + "':\n" + e.message);
- return false;
- }
-
- return true;
- };
-
-
-
- /**
- * Returns the pageset for a given UI specifier string.
- *
- * @param uiSpecifierString
- * @return a pageset object
- */
- this.getPageset = function(uiSpecifierString)
- {
- try {
- var uiSpecifier = new UISpecifier(uiSpecifierString);
- return this.pagesets[uiSpecifier.pagesetName];
- }
- catch (e) {
- return null;
- }
- }
-
-
-
- /**
- * Returns the UIElement that a UISpecifierString or pageset and element
- * pair refer to.
- *
- * @param pagesetNameOrUISpecifierString
- * @return a UIElement, or null if none is found associated with
- * uiSpecifierString
- */
- this.getUIElement = function(pagesetNameOrUISpecifierString, uiElementName)
- {
- var pagesetName = pagesetNameOrUISpecifierString;
- if (arguments.length == 1) {
- var uiSpecifierString = pagesetNameOrUISpecifierString;
- try {
- var uiSpecifier = new UISpecifier(uiSpecifierString);
- pagesetName = uiSpecifier.pagesetName;
- var uiElementName = uiSpecifier.elementName;
- }
- catch (e) {
- return null;
- }
- }
- try {
- return this.pagesets[pagesetName].uiElements[uiElementName];
- }
- catch (e) {
- return null;
- }
- };
-
-
-
- /**
- * Returns a list of pagesets that "contains" the provided page,
- * represented as a document object. Containership is defined by the
- * Pageset object's contain() method.
- *
- * @param inDocument the page to get pagesets for
- * @return a list of pagesets
- */
- this.getPagesetsForPage = function(inDocument)
- {
- var pagesets = [];
- for (var pagesetName in this.pagesets) {
- var pageset = this.pagesets[pagesetName];
- if (pageset.contains(inDocument)) {
- pagesets.push(pageset);
- }
- }
- return pagesets;
- };
-
-
-
- /**
- * Returns a list of all pagesets.
- *
- * @return a list of pagesets
- */
- this.getPagesets = function()
- {
- var pagesets = [];
- for (var pagesetName in this.pagesets) {
- pagesets.push(this.pagesets[pagesetName]);
- }
- return pagesets;
- };
-
-
-
- /**
- * Returns a list of elements on a page that a given UI specifier string,
- * maps to. If no elements are mapped to, returns an empty list..
- *
- * @param uiSpecifierString a String that specifies a UI element with
- * attendant argument values
- * @param inDocument the document object the specified UI element
- * appears in
- * @return a potentially-empty list of elements
- * specified by uiSpecifierString
- */
- this.getPageElements = function(uiSpecifierString, inDocument)
- {
- var locator = this.getLocator(uiSpecifierString);
- var results = locator ? eval_locator(locator, inDocument) : [];
- return results;
- };
-
-
-
- /**
- * Returns the locator string that a given UI specifier string maps to, or
- * null if it cannot be mapped.
- *
- * @param uiSpecifierString
- */
- this.getLocator = function(uiSpecifierString)
- {
- try {
- var uiSpecifier = new UISpecifier(uiSpecifierString);
- }
- catch (e) {
- safe_alert('Could not create UISpecifier for string "'
- + uiSpecifierString + '": ' + e.message);
- return null;
- }
-
- var uiElement = this.getUIElement(uiSpecifier.pagesetName,
- uiSpecifier.elementName);
- try {
- return uiElement.getLocator(uiSpecifier.args);
- }
- catch (e) {
- return null;
- }
- }
-
-
-
- /**
- * Finds and returns a UI specifier string given an element and the page
- * that it appears on.
- *
- * @param pageElement the document element to map to a UI specifier
- * @param inDocument the document the element appears in
- * @return a UI specifier string, or false if one cannot be
- * constructed
- */
- this.getUISpecifierString = function(pageElement, inDocument)
- {
- var is_fuzzy_match =
- BrowserBot.prototype.locateElementByUIElement.is_fuzzy_match;
- var pagesets = this.getPagesetsForPage(inDocument);
- for (var i = 0; i < pagesets.length; ++i) {
- var pageset = pagesets[i];
- var uiElements = pageset.getUIElements();
- for (var j = 0; j < uiElements.length; ++j) {
- var uiElement = uiElements[j];
-
- // first test against the generic locator, if there is one.
- // This should net some performance benefit when recording on
- // more complicated pages.
- if (uiElement.getGenericLocator) {
- var passedTest = false;
- var results =
- eval_locator(uiElement.getGenericLocator(), inDocument);
- for (var i = 0; i < results.length; ++i) {
- if (results[i] == pageElement) {
- passedTest = true;
- break;
- }
- }
- if (!passedTest) {
- continue;
- }
- }
-
- var defaultLocators;
- if (uiElement.isDefaultLocatorConstructionDeferred) {
- defaultLocators = uiElement.getDefaultLocators(inDocument);
- }
- else {
- defaultLocators = uiElement.defaultLocators;
- }
-
- //safe_alert(print_r(uiElement.defaultLocators));
- for (var locator in defaultLocators) {
- var locatedElements = eval_locator(locator, inDocument);
- if (locatedElements.length) {
- var locatedElement = locatedElements[0];
- }
- else {
- continue;
- }
-
- // use a heuristic to determine whether the element
- // specified is the "same" as the element we're matching
- if (is_fuzzy_match) {
- if (is_fuzzy_match(locatedElement, pageElement)) {
- return UI_GLOBAL.UI_PREFIX + '=' +
- new UISpecifier(pageset.name, uiElement.name,
- defaultLocators[locator]);
- }
- }
- else {
- if (locatedElement == pageElement) {
- return UI_GLOBAL.UI_PREFIX + '=' +
- new UISpecifier(pageset.name, uiElement.name,
- defaultLocators[locator]);
- }
- }
- // ok, matching the element failed. See if an offset
- // locator can complete the match.
- if (uiElement.getOffsetLocator) {
- for (var i = 0; i < locatedElements.length; ++i) {
- var offsetLocator = uiElement
- .getOffsetLocator(locatedElement, pageElement);
- if (offsetLocator) {
- return UI_GLOBAL.UI_PREFIX + '=' +
- new UISpecifier(pageset.name,
- uiElement.name,
- defaultLocators[locator])
- + '->' + offsetLocator;
- }
- }
- }
- }
- }
- }
- return false;
- };
-
-
-
- /**
- * Returns a sorted list of UI specifier string stubs representing possible
- * UI elements for all pagesets, paired the their descriptions. Stubs
- * contain all required arguments, but leave argument values blank.
- *
- * @return a list of UI specifier string stubs
- */
- this.getUISpecifierStringStubs = function() {
- var stubs = [];
- var pagesets = this.getPagesets();
- for (var i = 0; i < pagesets.length; ++i) {
- stubs = stubs.concat(pagesets[i].getUISpecifierStringStubs());
- }
- stubs.sort(function(a, b) {
- if (a[0] < b[0]) {
- return -1;
- }
- return a[0] == b[0] ? 0 : 1;
- });
- return stubs;
- }
-}
-
-UIMap.getInstance = function() {
- return (UIMap.self == null) ? new UIMap() : UIMap.self;
-}
-
-//******************************************************************************
-// Rollups
-
-/**
- * The Command object isn't available in the Selenium RC. We introduce an
- * object with the identical constructor. In the IDE, this will be redefined,
- * which is just fine.
- *
- * @param command
- * @param target
- * @param value
- */
-if (typeof(Command) == 'undefined') {
- function Command(command, target, value) {
- this.command = command != null ? command : '';
- this.target = target != null ? target : '';
- this.value = value != null ? value : '';
- }
-}
-
-
-
-/**
- * A CommandMatcher object matches commands during the application of a
- * RollupRule. It's specified with a shorthand format, for example:
- *
- * new CommandMatcher({
- * command: 'click'
- * , target: 'ui=allPages::.+'
- * })
- *
- * which is intended to match click commands whose target is an element in the
- * allPages PageSet. The matching expressions are given as regular expressions;
- * in the example above, the command must be "click"; "clickAndWait" would be
- * acceptable if 'click.*' were used. Here's a more complete example:
- *
- * new CommandMatcher({
- * command: 'type'
- * , target: 'ui=loginPages::username()'
- * , value: '.+_test'
- * , updateArgs: function(command, args) {
- * args.username = command.value;
- * }
- * })
- *
- * Here, the command and target are fixed, but there is variability in the
- * value of the command. When a command matches, the username is saved to the
- * arguments object.
- */
-function CommandMatcher(commandMatcherShorthand)
-{
- /**
- * Ensure the shorthand notation used to initialize the CommandMatcher has
- * all required values.
- *
- * @param commandMatcherShorthand an object containing information about
- * the CommandMatcher
- */
- this.validate = function(commandMatcherShorthand) {
- var msg = "CommandMatcher validation error:\n"
- + print_r(commandMatcherShorthand);
- if (!commandMatcherShorthand.command) {
- throw new CommandMatcherException(msg + 'no command specified!');
- }
- if (!commandMatcherShorthand.target) {
- throw new CommandMatcherException(msg + 'no target specified!');
- }
- if (commandMatcherShorthand.minMatches &&
- commandMatcherShorthand.maxMatches &&
- commandMatcherShorthand.minMatches >
- commandMatcherShorthand.maxMatches) {
- throw new CommandMatcherException(msg + 'minMatches > maxMatches!');
- }
- };
-
- /**
- * Initialize this object.
- *
- * @param commandMatcherShorthand an object containing information used to
- * initialize the CommandMatcher
- */
- this.init = function(commandMatcherShorthand) {
- this.validate(commandMatcherShorthand);
-
- this.command = commandMatcherShorthand.command;
- this.target = commandMatcherShorthand.target;
- this.value = commandMatcherShorthand.value || null;
- this.minMatches = commandMatcherShorthand.minMatches || 1;
- this.maxMatches = commandMatcherShorthand.maxMatches || 1;
- this.updateArgs = commandMatcherShorthand.updateArgs ||
- function(command, args) { return args; };
- };
-
- /**
- * Determines whether a given command matches. Updates args by "reference"
- * and returns true if it does; return false otherwise.
- *
- * @param command the command to attempt to match
- */
- this.isMatch = function(command) {
- var re = new RegExp('^' + this.command + '$');
- if (! re.test(command.command)) {
- return false;
- }
- re = new RegExp('^' + this.target + '$');
- if (! re.test(command.target)) {
- return false;
- }
- if (this.value != null) {
- re = new RegExp('^' + this.value + '$');
- if (! re.test(command.value)) {
- return false;
- }
- }
-
- // okay, the command matches
- return true;
- };
-
- // initialization
- this.init(commandMatcherShorthand);
-}
-
-
-
-function RollupRuleException(message)
-{
- this.message = message;
- this.name = 'RollupRuleException';
-}
-
-function RollupRule(rollupRuleShorthand)
-{
- /**
- * Ensure the shorthand notation used to initialize the RollupRule has all
- * required values.
- *
- * @param rollupRuleShorthand an object containing information about the
- * RollupRule
- */
- this.validate = function(rollupRuleShorthand) {
- var msg = "RollupRule validation error:\n"
- + print_r(rollupRuleShorthand);
- if (!rollupRuleShorthand.name) {
- throw new RollupRuleException(msg + 'no name specified!');
- }
- if (!rollupRuleShorthand.description) {
- throw new RollupRuleException(msg + 'no description specified!');
- }
- // rollupRuleShorthand.args is optional
- if (!rollupRuleShorthand.commandMatchers &&
- !rollupRuleShorthand.getRollup) {
- throw new RollupRuleException(msg
- + 'no command matchers specified!');
- }
- if (!rollupRuleShorthand.expandedCommands &&
- !rollupRuleShorthand.getExpandedCommands) {
- throw new RollupRuleException(msg
- + 'no expanded commands specified!');
- }
-
- return true;
- };
-
- /**
- * Initialize this object.
- *
- * @param rollupRuleShorthand an object containing information used to
- * initialize the RollupRule
- */
- this.init = function(rollupRuleShorthand) {
- this.validate(rollupRuleShorthand);
-
- this.name = rollupRuleShorthand.name;
- this.description = rollupRuleShorthand.description;
- this.pre = rollupRuleShorthand.pre || '';
- this.post = rollupRuleShorthand.post || '';
- this.alternateCommand = rollupRuleShorthand.alternateCommand;
- this.args = rollupRuleShorthand.args || [];
-
- if (rollupRuleShorthand.commandMatchers) {
- // construct the rule from the list of CommandMatchers
- this.commandMatchers = [];
- var matchers = rollupRuleShorthand.commandMatchers;
- for (var i = 0; i < matchers.length; ++i) {
- if (matchers[i].updateArgs && this.args.length == 0) {
- // enforce metadata for arguments
- var msg = "RollupRule validation error:\n"
- + print_r(rollupRuleShorthand)
- + 'no argument metadata provided!';
- throw new RollupRuleException(msg);
- }
- this.commandMatchers.push(new CommandMatcher(matchers[i]));
- }
-
- // returns false if the rollup doesn't match, or a rollup command
- // if it does. If returned, the command contains the
- // replacementIndexes property, which indicates which commands it
- // substitutes for.
- this.getRollup = function(commands) {
- // this is a greedy matching algorithm
- var replacementIndexes = [];
- var commandMatcherQueue = this.commandMatchers;
- var matchCount = 0;
- var args = {};
- for (var i = 0, j = 0; i < commandMatcherQueue.length;) {
- var matcher = commandMatcherQueue[i];
- if (j >= commands.length) {
- // we've run out of commands! If the remaining matchers
- // do not have minMatches requirements, this is a
- // match. Otherwise, it's not.
- if (matcher.minMatches > 0) {
- return false;
- }
- ++i;
- matchCount = 0; // unnecessary, but let's be consistent
- }
- else {
- if (matcher.isMatch(commands[j])) {
- ++matchCount;
- if (matchCount == matcher.maxMatches) {
- // exhausted this matcher's matches ... move on
- // to next matcher
- ++i;
- matchCount = 0;
- }
- args = matcher.updateArgs(commands[j], args);
- replacementIndexes.push(j);
- ++j; // move on to next command
- }
- else {
- //alert(matchCount + ', ' + matcher.minMatches);
- if (matchCount < matcher.minMatches) {
- return false;
- }
- // didn't match this time, but we've satisfied the
- // requirements already ... move on to next matcher
- ++i;
- matchCount = 0;
- // still gonna look at same command
- }
- }
- }
-
- var rollup;
- if (this.alternateCommand) {
- rollup = new Command(this.alternateCommand,
- commands[0].target, commands[0].value);
- }
- else {
- rollup = new Command('rollup', this.name);
- rollup.value = to_kwargs(args);
- }
- rollup.replacementIndexes = replacementIndexes;
- return rollup;
- };
- }
- else {
- this.getRollup = function(commands) {
- var result = rollupRuleShorthand.getRollup(commands);
- if (result) {
- var rollup = new Command(
- result.command
- , result.target
- , result.value
- );
- rollup.replacementIndexes = result.replacementIndexes;
- return rollup;
- }
- return false;
- };
- }
-
- this.getExpandedCommands = function(kwargs) {
- var commands = [];
- var expandedCommands = (rollupRuleShorthand.expandedCommands
- ? rollupRuleShorthand.expandedCommands
- : rollupRuleShorthand.getExpandedCommands(
- parse_kwargs(kwargs)));
- for (var i = 0; i < expandedCommands.length; ++i) {
- var command = expandedCommands[i];
- commands.push(new Command(
- command.command
- , command.target
- , command.value
- ));
- }
- return commands;
- };
- };
-
- this.init(rollupRuleShorthand);
-}
-
-
-
-/**
- *
- */
-function RollupManager()
-{
- // singleton pattern
- RollupManager.self = this;
-
- this.init = function()
- {
- this.rollupRules = {};
- if (is_IDE()) {
- Editor.rollupManager = this;
- }
- };
-
- /**
- * Adds a new RollupRule to the repository. Returns true on success, or
- * false if the rule couldn't be added.
- *
- * @param rollupRuleShorthand shorthand JSON specification of the new
- * RollupRule, possibly including CommandMatcher
- * shorthand too.
- * @return true if the rule was added successfully,
- * false otherwise.
- */
- this.addRollupRule = function(rollupRuleShorthand)
- {
- try {
- var rule = new RollupRule(rollupRuleShorthand);
- this.rollupRules[rule.name] = rule;
- }
- catch(e) {
- smart_alert("Could not create RollupRule from shorthand:\n\n"
- + e.message);
- return false;
- }
- return true;
- };
-
- /**
- * Returns a RollupRule by name.
- *
- * @param rollupName the name of the rule to fetch
- * @return the RollupRule, or null if it isn't found.
- */
- this.getRollupRule = function(rollupName)
- {
- return (this.rollupRules[rollupName] || null);
- };
-
- /**
- * Returns a list of name-description pairs for use in populating the
- * auto-populated target dropdown in the IDE. Rules that have an alternate
- * command defined are not included in the list, as they are not bona-fide
- * rollups.
- *
- * @return a list of name-description pairs
- */
- this.getRollupRulesForDropdown = function()
- {
- var targets = [];
- var names = keys(this.rollupRules).sort();
- for (var i = 0; i < names.length; ++i) {
- var name = names[i];
- if (this.rollupRules[name].alternateCommand) {
- continue;
- }
- targets.push([ name, this.rollupRules[name].description ]);
- }
- return targets;
- };
-
- /**
- * Applies all rules to the current editor commands, asking the user in
- * each case if it's okay to perform the replacement. The rules are applied
- * repeatedly until there are no more matches. The algorithm should
- * remember when the user has declined a replacement, and not ask to do it
- * again.
- *
- * @return the list of commands with rollup replacements performed
- */
- this.applyRollupRules = function()
- {
- var commands = editor.getTestCase().commands;
- var blacklistedRollups = {};
-
- // so long as rollups were performed, we need to keep iterating through
- // the commands starting at the beginning, because further rollups may
- // potentially be applied on the newly created ones.
- while (true) {
- var performedRollup = false;
- for (var i = 0; i < commands.length; ++i) {
- // iterate through commands
- for (var rollupName in this.rollupRules) {
- var rule = this.rollupRules[rollupName];
- var rollup = rule.getRollup(commands.slice(i));
- if (rollup) {
- // since we passed in a sliced version of the commands
- // array to the getRollup() method, we need to re-add
- // the offset to the replacementIndexes
- var k = 0;
- for (; k < rollup.replacementIndexes.length; ++k) {
- rollup.replacementIndexes[k] += i;
- }
-
- // build the confirmation message
- var msg = "Perform the following command rollup?\n\n";
- for (k = 0; k < rollup.replacementIndexes.length; ++k) {
- var replacementIndex = rollup.replacementIndexes[k];
- var command = commands[replacementIndex];
- msg += '[' + replacementIndex + ']: ';
- msg += command + "\n";
- }
- msg += "\n";
- msg += rollup;
-
- // check against blacklisted rollups
- if (blacklistedRollups[msg]) {
- continue;
- }
-
- // highlight the potentially replaced rows
- for (k = 0; k < commands.length; ++k) {
- var command = commands[k];
- command.result = '';
- if (rollup.replacementIndexes.indexOf(k) != -1) {
- command.selectedForReplacement = true;
- }
- editor.view.rowUpdated(replacementIndex);
- }
-
- // get confirmation from user
- if (confirm(msg)) {
- // perform rollup
- var deleteRanges = [];
- var replacementIndexes = rollup.replacementIndexes;
- for (k = 0; k < replacementIndexes.length; ++k) {
- // this is expected to be list of ranges. A
- // range has a start, and a list of commands.
- // The deletion only checks the length of the
- // command list.
- deleteRanges.push({
- start: replacementIndexes[k]
- , commands: [ 1 ]
- });
- }
- editor.view.executeAction(new TreeView
- .DeleteCommandAction(editor.view,deleteRanges));
- editor.view.insertAt(i, rollup);
-
- performedRollup = true;
- }
- else {
- // cleverly remember not to try this rollup again
- blacklistedRollups[msg] = true;
- }
-
- // unhighlight
- for (k = 0; k < commands.length; ++k) {
- commands[k].selectedForReplacement = false;
- editor.view.rowUpdated(k);
- }
- }
- }
- }
- if (!performedRollup) {
- break;
- }
- }
- return commands;
- };
-
- this.init();
-}
-
-RollupManager.getInstance = function() {
- return (RollupManager.self == null)
- ? new RollupManager()
- : RollupManager.self;
-}
-
diff --git a/vendor/plugins/selenium-on-rails/selenium-core/scripts/ui-map-sample.js b/vendor/plugins/selenium-on-rails/selenium-core/scripts/ui-map-sample.js
deleted file mode 100644
index 37ab84b7..00000000
--- a/vendor/plugins/selenium-on-rails/selenium-core/scripts/ui-map-sample.js
+++ /dev/null
@@ -1,979 +0,0 @@
-// sample UI element mapping definition. This is for http://alistapart.com/,
-// a particularly well structured site on web design principles.
-
-
-
-// in general, the map should capture structural aspects of the system, instead
-// of "content". In other words, interactive elements / assertible elements
-// that can be counted on to always exist should be defined here. Content -
-// for example text or a link that appears in a blog entry - is always liable
-// to change, and will not be fun to represent in this way. You probably don't
-// want to be testing specific content anyway.
-
-// create the UI mapping object. THIS IS THE MOST IMPORTANT PART - DON'T FORGET
-// TO DO THIS! In order for it to come into play, a user extension must
-// construct the map in this way.
-var myMap = new UIMap();
-
-
-
-
-// any values which may appear multiple times can be defined as variables here.
-// For example, here we're enumerating a list of top level topics that will be
-// used as default argument values for several UI elements. Check out how
-// this variable is referenced further down.
-var topics = [
- 'Code',
- 'Content',
- 'Culture',
- 'Design',
- 'Process',
- 'User Science'
-];
-
-// map subtopics to their parent topics
-var subtopics = {
- 'Browsers': 'Code'
- , 'CSS': 'Code'
- , 'Flash': 'Code'
- , 'HTML and XHTML': 'Code'
- , 'Scripting': 'Code'
- , 'Server Side': 'Code'
- , 'XML': 'Code'
- , 'Brand Arts': 'Content'
- , 'Community': 'Content'
- , 'Writing': 'Content'
- , 'Industry': 'Culture'
- , 'Politics and Money': 'Culture'
- , 'State of the Web': 'Culture'
- , 'Graphic Design': 'Design'
- , 'User Interface Design': 'Design'
- , 'Typography': 'Design'
- , 'Layout': 'Design'
- , 'Business': 'Process'
- , 'Creativity': 'Process'
- , 'Project Management and Workflow': 'Process'
- , 'Accessibility': 'User Science'
- , 'Information Architecture': 'User Science'
- , 'Usability': 'User Science'
-};
-
-
-
-// define UI elements common for all pages. This regular expression does the
-// trick. '^' is automatically prepended, and '$' is automatically postpended.
-// Please note that because the regular expression is being represented as a
-// string, all backslashes must be escaped with an additional backslash. Also
-// note that the URL being matched will always have any trailing forward slash
-// stripped.
-myMap.addPageset({
- name: 'allPages'
- , description: 'all alistapart.com pages'
- , pathRegexp: '.*'
-});
-myMap.addElement('allPages', {
- name: 'masthead'
- // the description should be short and to the point, usually no longer than
- // a single line
- , description: 'top level image link to site homepage'
- // make sure the function returns the XPath ... it's easy to leave out the
- // "return" statement by accident!
- , locator: "xpath=//*[@id='masthead']/a/img"
- , testcase1: {
- xhtml: ''
- }
-});
-myMap.addElement('allPages', {
- // be VERY CAREFUL to include commas in the correct place. Missing commas
- // and extra commas can cause lots of headaches when debugging map
- // definition files!!!
- name: 'current_issue'
- , description: 'top level link to issue currently being browsed'
- , locator: "//div[@id='ish']/a"
- , testcase1: {
- xhtml: ''
- }
-});
-myMap.addElement('allPages', {
- name: 'section'
- , description: 'top level link to articles section'
- , args: [
- {
- name: 'section'
- , description: 'the name of the section'
- , defaultValues: [
- 'articles'
- , 'topics'
- , 'about'
- , 'contact'
- , 'contribute'
- , 'feed'
- ]
- }
- ]
- // getXPath has been deprecated by getLocator, but verify backward
- // compatability here
- , getXPath: function(args) {
- return "//li[@id=" + args.section.quoteForXPath() + "]/a";
- }
- , testcase1: {
- args: { section: 'feed' }
- , xhtml: ''
- }
-});
-myMap.addElement('allPages', {
- name: 'search_box'
- , description: 'site search input field'
- // xpath has been deprecated by locator, but verify backward compatability
- , xpath: "//input[@id='search']"
- , testcase1: {
- xhtml: ''
- }
-});
-myMap.addElement('allPages', {
- name: 'search_discussions'
- , description: 'site search include discussions checkbox'
- , locator: 'incdisc'
- , testcase1: {
- xhtml: ''
- }
-});
-myMap.addElement('allPages', {
- name: 'search_submit'
- , description: 'site search submission button'
- , locator: 'submit'
- , testcase1: {
- xhtml: ''
- }
-});
-myMap.addElement('allPages', {
- name: 'topics'
- , description: 'sidebar links to topic categories'
- , args: [
- {
- name: 'topic'
- , description: 'the name of the topic'
- , defaultValues: topics
- }
- ]
- , getLocator: function(args) {
- return "//div[@id='topiclist']/ul/li" +
- "/a[text()=" + args.topic.quoteForXPath() + "]";
- }
- , testcase1: {
- args: { topic: 'foo' }
- , xhtml: ''
- }
-});
-myMap.addElement('allPages', {
- name: 'copyright'
- , description: 'footer link to copyright page'
- , getLocator: function(args) { return "//span[@class='copyright']/a"; }
- , testcase1: {
- xhtml: ''
- }
-});
-
-
-
-// define UI elements for the homepage, i.e. "http://alistapart.com/", and
-// magazine issue pages, i.e. "http://alistapart.com/issues/234".
-myMap.addPageset({
- name: 'issuePages'
- , description: 'pages including magazine issues'
- , pathRegexp: '(issues/.+)?'
-});
-myMap.addElement('issuePages', {
- name: 'article'
- , description: 'front or issue page link to article'
- , args: [
- {
- name: 'index'
- , description: 'the index of the article'
- // an array of default values for the argument. A default
- // value is one that is passed to the getXPath() method of
- // the container UIElement object when trying to build an
- // element locator.
- //
- // range() may be used to count easily. Remember though that
- // the ending value does not include the right extreme; for
- // example range(1, 5) counts from 1 to 4 only.
- , defaultValues: range(1, 5)
- }
- ]
- , getLocator: function(args) {
- return "//div[@class='item'][" + args.index + "]/h4/a";
- }
-});
-myMap.addElement('issuePages', {
- name: 'author'
- , description: 'article author link'
- , args: [
- {
- name: 'index'
- , description: 'the index of the author, by article'
- , defaultValues: range(1, 5)
- }
- ]
- , getLocator: function(args) {
- return "//div[@class='item'][" + args.index + "]/h5/a";
- }
-});
-myMap.addElement('issuePages', {
- name: 'store'
- , description: 'alistapart.com store link'
- , locator: "//ul[@id='banners']/li/a[@title='ALA Store']/img"
-});
-myMap.addElement('issuePages', {
- name: 'special_article'
- , description: "editor's choice article link"
- , locator: "//div[@id='choice']/h4/a"
-});
-myMap.addElement('issuePages', {
- name: 'special_author'
- , description: "author link of editor's choice article"
- , locator: "//div[@id='choice']/h5/a"
-});
-
-
-
-// define UI elements for the articles page, i.e.
-// "http://alistapart.com/articles"
-myMap.addPageset({
- name: 'articleListPages'
- , description: 'page with article listings'
- , paths: [ 'articles' ]
-});
-myMap.addElement('articleListPages', {
- name: 'issue'
- , description: 'link to issue'
- , args: [
- {
- name: 'index'
- , description: 'the index of the issue on the page'
- , defaultValues: range(1, 10)
- }
- ]
- , getLocator: function(args) {
- return "//h2[@class='ishinfo'][" + args.index + ']/a';
- }
- , genericLocator: "//h2[@class='ishinfo']/a"
-});
-myMap.addElement('articleListPages', {
- name: 'article'
- , description: 'link to article, by issue and article number'
- , args: [
- {
- name: 'issue_index'
- , description: "the index of the article's issue on the page; "
- + 'typically five per page'
- , defaultValues: range(1, 6)
- }
- , {
- name: 'article_index'
- , description: 'the index of the article within the issue; '
- + 'typically two per issue'
- , defaultValues: range(1, 5)
- }
- ]
- , getLocator: function(args) {
- var xpath = "//h2[@class='ishinfo'][" + (args.issue_index || 1) + ']'
- + "/following-sibling::div[@class='item']"
- + '[' + (args.article_index || 1) + "]/h3[@class='title']/a";
- return xpath;
- }
- , genericLocator: "//h2[@class='ishinfo']"
- + "/following-sibling::div[@class='item']/h3[@class='title']/a"
-});
-myMap.addElement('articleListPages', {
- name: 'author'
- , description: 'article author link, by issue and article'
- , args: [
- {
- name: 'issue_index'
- , description: "the index of the article's issue on the page; \
-typically five per page"
- , defaultValues: range(1, 6)
- }
- , {
- name: 'article_index'
- , description: "the index of the article within the issue; \
-typically two articles per issue"
- , defaultValues: range(1, 3)
- }
- ]
- // this XPath uses the "following-sibling" axis. The div elements for
- // the articles in an issue are not children, but siblings of the h2
- // element identifying the article.
- , getLocator: function(args) {
- var xpath = "//h2[@class='ishinfo'][" + (args.issue_index || 1) + ']'
- + "/following-sibling::div[@class='item']"
- + '[' + (args.article_index || 1) + "]/h4[@class='byline']/a";
- return xpath;
- }
- , genericLocator: "//h2[@class='ishinfo']"
- + "/following-sibling::div[@class='item']/h4[@class='byline']/a"
-});
-myMap.addElement('articleListPages', {
- name: 'next_page'
- , description: 'link to next page of articles (older)'
- , locator: "//a[contains(text(),'Next page')]"
-});
-myMap.addElement('articleListPages', {
- name: 'previous_page'
- , description: 'link to previous page of articles (newer)'
- , locator: "//a[contains(text(),'Previous page')]"
-});
-
-
-
-// define UI elements for specific article pages, i.e.
-// "http://alistapart.com/articles/culturalprobe"
-myMap.addPageset({
- name: 'articlePages'
- , description: 'pages for actual articles'
- , pathRegexp: 'articles/.+'
-});
-myMap.addElement('articlePages', {
- name: 'title'
- , description: 'article title loop-link'
- , locator: "//div[@id='content']/h1[@class='title']/a"
-});
-myMap.addElement('articlePages', {
- name: 'author'
- , description: 'article author link'
- , locator: "//div[@id='content']/h3[@class='byline']/a"
-});
-myMap.addElement('articlePages', {
- name: 'article_topics'
- , description: 'links to topics under which article is published, before \
-article content'
- , args: [
- {
- name: 'topic'
- , description: 'the name of the topic'
- , defaultValues: keys(subtopics)
- }
- ]
- , getLocator: function(args) {
- return "//ul[@id='metastuff']/li/a"
- + "[@title=" + args.topic.quoteForXPath() + "]";
- }
-});
-myMap.addElement('articlePages', {
- name: 'discuss'
- , description: 'link to article discussion area, before article content'
- , locator: "//ul[@id='metastuff']/li[@class='discuss']/p/a"
-});
-myMap.addElement('articlePages', {
- name: 'related_topics'
- , description: 'links to topics under which article is published, after \
-article content'
- , args: [
- {
- name: 'topic'
- , description: 'the name of the topic'
- , defaultValues: keys(subtopics)
- }
- ]
- , getLocator: function(args) {
- return "//div[@id='learnmore']/p/a"
- + "[@title=" + args.topic.quoteForXPath() + "]";
- }
-});
-myMap.addElement('articlePages', {
- name: 'join_discussion'
- , description: 'link to article discussion area, after article content'
- , locator: "//div[@class='discuss']/p/a"
-});
-
-
-
-myMap.addPageset({
- name: 'topicListingPages'
- , description: 'top level listing of topics'
- , paths: [ 'topics' ]
-});
-myMap.addElement('topicListingPages', {
- name: 'topic'
- , description: 'link to topic category'
- , args: [
- {
- name: 'topic'
- , description: 'the name of the topic'
- , defaultValues: topics
- }
- ]
- , getLocator: function(args) {
- return "//div[@id='content']/h2/a"
- + "[text()=" + args.topic.quoteForXPath() + "]";
- }
-});
-myMap.addElement('topicListingPages', {
- name: 'subtopic'
- , description: 'link to subtopic category'
- , args: [
- {
- name: 'subtopic'
- , description: 'the name of the subtopic'
- , defaultValues: keys(subtopics)
- }
- ]
- , getLocator: function(args) {
- return "//div[@id='content']" +
- "/descendant::a[text()=" + args.subtopic.quoteForXPath() + "]";
- }
-});
-
-// the following few subtopic page UI elements are very similar. Define UI
-// elements for the code page, which is a subpage under topics, i.e.
-// "http://alistapart.com/topics/code/"
-myMap.addPageset({
- name: 'subtopicListingPages'
- , description: 'pages listing subtopics'
- , pathPrefix: 'topics/'
- , paths: [
- 'code'
- , 'content'
- , 'culture'
- , 'design'
- , 'process'
- , 'userscience'
- ]
-});
-myMap.addElement('subtopicListingPages', {
- name: 'subtopic'
- , description: 'link to a subtopic category'
- , args: [
- {
- name: 'subtopic'
- , description: 'the name of the subtopic'
- , defaultValues: keys(subtopics)
- }
- ]
- , getLocator: function(args) {
- return "//div[@id='content']/h2" +
- "/a[text()=" + args.subtopic.quoteForXPath() + "]";
- }
-});
-
-
-
-// subtopic articles page
-myMap.addPageset({
- name: 'subtopicArticleListingPages'
- , description: 'pages listing the articles for a given subtopic'
- , pathRegexp: 'topics/[^/]+/.+'
-});
-myMap.addElement('subtopicArticleListingPages', {
- name: 'article'
- , description: 'link to a subtopic article'
- , args: [
- {
- name: 'index'
- , description: 'the index of the article'
- , defaultValues: range(1, 51) // the range seems unlimited ...
- }
- ]
- , getLocator: function(args) {
- return "//div[@id='content']/div[@class='item']"
- + "[" + args.index + "]/h3/a";
- }
- , testcase1: {
- args: { index: 2 }
- , xhtml: ''
- }
-});
-myMap.addElement('subtopicArticleListingPages', {
- name: 'author'
- , description: "link to a subtopic article author's page"
- , args: [
- {
- name: 'article_index'
- , description: 'the index of the authored article'
- , defaultValues: range(1, 51)
- }
- , {
- name: 'author_index'
- , description: 'the index of the author when there are multiple'
- , defaultValues: range(1, 4)
- }
- ]
- , getLocator: function(args) {
- return "//div[@id='content']/div[@class='item'][" +
- args.article_index + "]/h4/a[" +
- (args.author_index ? args.author_index : '1') + ']';
- }
-});
-myMap.addElement('subtopicArticleListingPages', {
- name: 'issue'
- , description: 'link to issue a subtopic article appears in'
- , args: [
- {
- name: 'index'
- , description: 'the index of the subtopic article'
- , defaultValues: range(1, 51)
- }
- ]
- , getLocator: function(args) {
- return "//div[@id='content']/div[@class='item']"
- + "[" + args.index + "]/h5/a";
- }
-});
-
-
-
-myMap.addPageset({
- name: 'aboutPages'
- , description: 'the website about page'
- , paths: [ 'about' ]
-});
-myMap.addElement('aboutPages', {
- name: 'crew'
- , description: 'link to site crew member bio or personal website'
- , args: [
- {
- name: 'role'
- , description: 'the role of the crew member'
- , defaultValues: [
- 'ALA Crew'
- , 'Support'
- , 'Emeritus'
- ]
- }
- , {
- name: 'role_index'
- , description: 'the index of the member within the role'
- , defaultValues: range(1, 20)
- }
- , {
- name: 'member_index'
- , description: 'the index of the member within the role title'
- , defaultValues: range(1, 5)
- }
- ]
- , getLocator: function(args) {
- // the first role is kind of funky, and requires a conditional to
- // build the XPath correctly. Its header looks like this:
- //
- //
- // ALA 4.0 CREW
- //
- //
- // This kind of complexity is a little daunting, but you can see
- // how the format can handle it relatively easily and concisely.
- if (args.role == 'ALA Crew') {
- var selector = "descendant::text()='CREW'";
- }
- else {
- var selector = "text()=" + args.role.quoteForXPath();
- }
- var xpath =
- "//div[@id='secondary']/h3[" + selector + ']' +
- "/following-sibling::dl/dt[" + (args.role_index || 1) + ']' +
- '/a[' + (args.member_index || '1') + ']';
- return xpath;
- }
-});
-
-
-
-myMap.addPageset({
- name: 'searchResultsPages'
- , description: 'pages listing search results'
- , paths: [ 'search' ]
-});
-myMap.addElement('searchResultsPages', {
- name: 'result_link'
- , description: 'search result link'
- , args: [
- {
- name: 'index'
- , description: 'the index of the search result'
- , defaultValues: range(1, 11)
- }
- ]
- , getLocator: function(args) {
- return "//div[@id='content']/ul[" + args.index + ']/li/h3/a';
- }
-});
-myMap.addElement('searchResultsPages', {
- name: 'more_results_link'
- , description: 'next or previous results link at top or bottom of page'
- , args: [
- {
- name: 'direction'
- , description: 'next or previous results page'
- // demonstrate a method which acquires default values from the
- // document object. Such default values may contain EITHER commas
- // OR equals signs, but NOT BOTH.
- , getDefaultValues: function(inDocument) {
- var defaultValues = [];
- var divs = inDocument.getElementsByTagName('div');
- for (var i = 0; i < divs.length; ++i) {
- if (divs[i].className == 'pages') {
- break;
- }
- }
- var links = divs[i].getElementsByTagName('a');
- for (i = 0; i < links.length; ++i) {
- defaultValues.push(links[i].innerHTML
- .replace(/^\xab\s*/, "")
- .replace(/\s*\bb$/, "")
- .replace(/\s*\d+$/, ""));
- }
- return defaultValues;
- }
- }
- , {
- name: 'position'
- , description: 'position of the link'
- , defaultValues: ['top', 'bottom']
- }
- ]
- , getLocator: function(args) {
- return "//div[@id='content']/div[@class='pages']["
- + (args.position == 'top' ? '1' : '2') + ']'
- + "/a[contains(text(), "
- + (args.direction ? args.direction.quoteForXPath() : undefined)
- + ")]";
- }
-});
-
-
-
-myMap.addPageset({
- name: 'commentsPages'
- , description: 'pages listing comments made to an article'
- , pathRegexp: 'comments/.+'
-});
-myMap.addElement('commentsPages', {
- name: 'article_link'
- , description: 'link back to the original article'
- , locator: "//div[@id='content']/h1[@class='title']/a"
-});
-myMap.addElement('commentsPages', {
- name: 'comment_link'
- , description: 'same-page link to comment'
- , args: [
- {
- name: 'index'
- , description: 'the index of the comment'
- , defaultValues: range(1, 11)
- }
- ]
- , getLocator: function(args) {
- return "//div[@class='content']/div[contains(@class, 'comment')]" +
- '[' + args.index + ']/h4/a[2]';
- }
-});
-myMap.addElement('commentsPages', {
- name: 'paging_link'
- , description: 'links to more pages of comments'
- , args: [
- {
- name: 'dest'
- , description: 'the destination page'
- , defaultValues: ['next', 'prev'].concat(range(1, 16))
- }
- , {
- name: 'position'
- , description: 'position of the link'
- , defaultValues: ['top', 'bottom']
- }
- ]
- , getLocator: function(args) {
- var dest = args.dest;
- var xpath = "//div[@id='content']/div[@class='pages']" +
- '[' + (args.position == 'top' ? '1' : '2') + ']/p';
- if (dest == 'next' || dest == 'prev') {
- xpath += "/a[contains(text(), " + dest.quoteForXPath() + ")]";
- }
- else {
- xpath += "/a[text()=" + dest.quoteForXPath() + "]";
- }
- return xpath;
- }
-});
-
-
-
-myMap.addPageset({
- name: 'authorPages'
- , description: 'personal pages for each author'
- , pathRegexp: 'authors/[a-z]/.+'
-});
-myMap.addElement('authorPages', {
- name: 'article'
- , description: "link to article written by this author.\n"
- + 'This description has a line break.'
- , args: [
- {
- name: 'index'
- , description: 'index of the article on the page'
- , defaultValues: range(1, 11)
- }
- ]
- , getLocator: function(args) {
- var index = args.index;
- // try out the CSS locator!
- //return "//h4[@class='title'][" + index + "]/a";
- return 'css=h4.title:nth-child(' + index + ') > a';
- }
- , testcase1: {
- args: { index: '2' }
- , xhtml: ''
- + '
'
- }
-});
-
-
-
-// test the offset locator. Something like the following can be recorded:
-// ui=qaPages::content()//a[contains(text(),'May I quote from your articles?')]
-myMap.addPageset({
- name: 'qaPages'
- , description: 'question and answer pages'
- , pathRegexp: 'qa'
-});
-myMap.addElement('qaPages', {
- name: 'content'
- , description: 'the content pane containing the q&a entries'
- , locator: "//div[@id='content' and "
- + "child::h1[text()='Questions and Answers']]"
- , getOffsetLocator: UIElement.defaultOffsetLocatorStrategy
-});
-myMap.addElement('qaPages', {
- name: 'last_updated'
- , description: 'displays the last update date'
- // demonstrate calling getLocator() for another UI element within a
- // getLocator(). The former must have already been added to the map. And
- // obviously, you can't randomly combine different locator types!
- , locator: myMap.getUIElement('qaPages', 'content').getLocator() + '/p/em'
-});
-
-
-
-//******************************************************************************
-
-var myRollupManager = new RollupManager();
-
-// though the description element is required, its content is free form. You
-// might want to create a documentation policy as given below, where the pre-
-// and post-conditions of the rollup are spelled out.
-//
-// To take advantage of a "heredoc" like syntax for longer descriptions,
-// add a backslash to the end of the current line and continue the string on
-// the next line.
-myRollupManager.addRollupRule({
- name: 'navigate_to_subtopic_article_listing'
- , description: 'drill down to the listing of articles for a given subtopic \
-from the section menu, then the topic itself.'
- , pre: 'current page contains the section menu (most pages should)'
- , post: 'navigated to the page listing all articles for a given subtopic'
- , args: [
- {
- name: 'subtopic'
- , description: 'the subtopic whose article listing to navigate to'
- , exampleValues: keys(subtopics)
- }
- ]
- , commandMatchers: [
- {
- command: 'clickAndWait'
- , target: 'ui=allPages::section\\(section=topics\\)'
- // must escape parentheses in the the above target, since the
- // string is being used as a regular expression. Again, backslashes
- // in strings must be escaped too.
- }
- , {
- command: 'clickAndWait'
- , target: 'ui=topicListingPages::topic\\(.+'
- }
- , {
- command: 'clickAndWait'
- , target: 'ui=subtopicListingPages::subtopic\\(.+'
- , updateArgs: function(command, args) {
- // don't bother stripping the "ui=" prefix from the locator
- // here; we're just using UISpecifier to parse the args out
- var uiSpecifier = new UISpecifier(command.target);
- args.subtopic = uiSpecifier.args.subtopic;
- return args;
- }
- }
- ]
- , getExpandedCommands: function(args) {
- var commands = [];
- var topic = subtopics[args.subtopic];
- var subtopic = args.subtopic;
- commands.push({
- command: 'clickAndWait'
- , target: 'ui=allPages::section(section=topics)'
- });
- commands.push({
- command: 'clickAndWait'
- , target: 'ui=topicListingPages::topic(topic=' + topic + ')'
- });
- commands.push({
- command: 'clickAndWait'
- , target: 'ui=subtopicListingPages::subtopic(subtopic=' + subtopic
- + ')'
- });
- commands.push({
- command: 'verifyLocation'
- , target: 'regexp:.+/topics/.+/.+'
- });
- return commands;
- }
-});
-
-
-
-myRollupManager.addRollupRule({
- name: 'replace_click_with_clickAndWait'
- , description: 'replaces commands where a click was detected with \
-clickAndWait instead'
- , alternateCommand: 'clickAndWait'
- , commandMatchers: [
- {
- command: 'click'
- , target: 'ui=subtopicArticleListingPages::article\\(.+'
- }
- ]
- , expandedCommands: []
-});
-
-
-
-myRollupManager.addRollupRule({
- name: 'navigate_to_subtopic_article'
- , description: 'navigate to an article listed under a subtopic.'
- , pre: 'current page contains the section menu (most pages should)'
- , post: 'navigated to an article page'
- , args: [
- {
- name: 'subtopic'
- , description: 'the subtopic whose article listing to navigate to'
- , exampleValues: keys(subtopics)
- }
- , {
- name: 'index'
- , description: 'the index of the article in the listing'
- , exampleValues: range(1, 11)
- }
- ]
- , commandMatchers: [
- {
- command: 'rollup'
- , target: 'navigate_to_subtopic_article_listing'
- , value: 'subtopic\\s*=.+'
- , updateArgs: function(command, args) {
- var args1 = parse_kwargs(command.value);
- args.subtopic = args1.subtopic;
- return args;
- }
- }
- , {
- command: 'clickAndWait'
- , target: 'ui=subtopicArticleListingPages::article\\(.+'
- , updateArgs: function(command, args) {
- var uiSpecifier = new UISpecifier(command.target);
- args.index = uiSpecifier.args.index;
- return args;
- }
- }
- ]
- /*
- // this is pretty much equivalent to the commandMatchers immediately above.
- // Seems more verbose and less expressive, doesn't it? But sometimes you
- // might prefer the flexibility of a function.
- , getRollup: function(commands) {
- if (commands.length >= 2) {
- command1 = commands[0];
- command2 = commands[1];
- var args1 = parse_kwargs(command1.value);
- try {
- var uiSpecifier = new UISpecifier(command2.target
- .replace(/^ui=/, ''));
- }
- catch (e) {
- return false;
- }
- if (command1.command == 'rollup' &&
- command1.target == 'navigate_to_subtopic_article_listing' &&
- args1.subtopic &&
- command2.command == 'clickAndWait' &&
- uiSpecifier.pagesetName == 'subtopicArticleListingPages' &&
- uiSpecifier.elementName == 'article') {
- var args = {
- subtopic: args1.subtopic
- , index: uiSpecifier.args.index
- };
- return {
- command: 'rollup'
- , target: this.name
- , value: to_kwargs(args)
- , replacementIndexes: [ 0, 1 ]
- };
- }
- }
- return false;
- }
- */
- , getExpandedCommands: function(args) {
- var commands = [];
- commands.push({
- command: 'rollup'
- , target: 'navigate_to_subtopic_article_listing'
- , value: to_kwargs({ subtopic: args.subtopic })
- });
- var uiSpecifier = new UISpecifier(
- 'subtopicArticleListingPages'
- , 'article'
- , { index: args.index });
- commands.push({
- command: 'clickAndWait'
- , target: 'ui=' + uiSpecifier.toString()
- });
- commands.push({
- command: 'verifyLocation'
- , target: 'regexp:.+/articles/.+'
- });
- return commands;
- }
-});
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/vendor/plugins/selenium-on-rails/selenium-core/scripts/user-extensions.js b/vendor/plugins/selenium-on-rails/selenium-core/scripts/user-extensions.js
deleted file mode 100644
index dde72cac..00000000
--- a/vendor/plugins/selenium-on-rails/selenium-core/scripts/user-extensions.js
+++ /dev/null
@@ -1,6 +0,0 @@
-// All get* methods on the Selenium prototype result in
-// store, assert, assertNot, verify, verifyNot, waitFor, and waitForNot commands.
-// Will result in support for storeContextCount, assertContextCount, etc.
-Selenium.prototype.getContextCount = function() {
- return this.browserbot.getCurrentWindow().$('.context').size();
-};
diff --git a/vendor/plugins/selenium-on-rails/selenium-core/scripts/user-extensions.js.sample b/vendor/plugins/selenium-on-rails/selenium-core/scripts/user-extensions.js.sample
deleted file mode 100644
index 0f0ca840..00000000
--- a/vendor/plugins/selenium-on-rails/selenium-core/scripts/user-extensions.js.sample
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * By default, Selenium looks for a file called "user-extensions.js", and loads and javascript
- * code found in that file. This file is a sample of what that file could look like.
- *
- * user-extensions.js provides a convenient location for adding extensions to Selenium, like
- * new actions, checks and locator-strategies.
- * By default, this file does not exist. Users can create this file and place their extension code
- * in this common location, removing the need to modify the Selenium sources, and hopefully assisting
- * with the upgrade process.
- *
- * You can find contributed extensions at http://wiki.openqa.org/display/SEL/Contributed%20User-Extensions
- */
-
-// The following examples try to give an indication of how Selenium can be extended with javascript.
-
-// All do* methods on the Selenium prototype are added as actions.
-// Eg add a typeRepeated action to Selenium, which types the text twice into a text box.
-// The typeTwiceAndWait command will be available automatically
-Selenium.prototype.doTypeRepeated = function(locator, text) {
- // All locator-strategies are automatically handled by "findElement"
- var element = this.page().findElement(locator);
-
- // Create the text to type
- var valueToType = text + text;
-
- // Replace the element text with the new text
- this.page().replaceText(element, valueToType);
-};
-
-// All assert* methods on the Selenium prototype are added as checks.
-// Eg add a assertValueRepeated check, that makes sure that the element value
-// consists of the supplied text repeated.
-// The verify version will be available automatically.
-Selenium.prototype.assertValueRepeated = function(locator, text) {
- // All locator-strategies are automatically handled by "findElement"
- var element = this.page().findElement(locator);
-
- // Create the text to verify
- var expectedValue = text + text;
-
- // Get the actual element value
- var actualValue = element.value;
-
- // Make sure the actual value matches the expected
- Assert.matches(expectedValue, actualValue);
-};
-
-// All get* methods on the Selenium prototype result in
-// store, assert, assertNot, verify, verifyNot, waitFor, and waitForNot commands.
-// E.g. add a getTextLength method that returns the length of the text
-// of a specified element.
-// Will result in support for storeTextLength, assertTextLength, etc.
-Selenium.prototype.getTextLength = function(locator) {
- return this.getText(locator).length;
-};
-
-// All locateElementBy* methods are added as locator-strategies.
-// Eg add a "valuerepeated=" locator, that finds the first element with the supplied value, repeated.
-// The "inDocument" is a the document you are searching.
-PageBot.prototype.locateElementByValueRepeated = function(text, inDocument) {
- // Create the text to search for
- var expectedValue = text + text;
-
- // Loop through all elements, looking for ones that have a value === our expected value
- var allElements = inDocument.getElementsByTagName("*");
- for (var i = 0; i < allElements.length; i++) {
- var testElement = allElements[i];
- if (testElement.value && testElement.value === expectedValue) {
- return testElement;
- }
- }
- return null;
-};
-
-
diff --git a/vendor/plugins/selenium-on-rails/selenium-core/scripts/xmlextras.js b/vendor/plugins/selenium-on-rails/selenium-core/scripts/xmlextras.js
deleted file mode 100644
index 267aa058..00000000
--- a/vendor/plugins/selenium-on-rails/selenium-core/scripts/xmlextras.js
+++ /dev/null
@@ -1,153 +0,0 @@
-// This is a third party JavaScript library from
-// http://webfx.eae.net/dhtml/xmlextras/xmlextras.html
-// i.e. This has not been written by ThoughtWorks.
-
-//
-
-EOS
- end
-
- def teardown
- FileUtils.rm_rf @result_dir
- end
-
- def test_record_with_result
- @controller.instance_variable_set(:@result_dir, @result_dir)
-
- post :record, :suite => @suite, "testTable.1" => "", "testTable.2" => ""
-
- cur_result_dir = File.join(@result_dir, "default")
- assert File.directory?(cur_result_dir)
- assert_equal ["blank.html", "index.html", "suite.html", "test1.html", "test2.html"],
- Dir.glob("#{cur_result_dir}/*.html").map{|path| File.basename(path)}.sort
-
- expected = <
-
-
-
-
-
-
-EOS
- assert_equal expected, File.read("#{cur_result_dir}/suite.html")
- end
-
- def test_result_hash
- post :record, :suite => @suite, "testTable.1" => "", "testTable.2" => "",
- :result => 'Failed', :numTestFailures => "906", :numTestPasses => "1079", :numCommandFailures => '1027',
- :numCommandErrors => '57', :numCommandPasses => '3', :totalTime => "A long time"
-
- assert_equal 'Failed', assigns['result']['result']
- assert_equal '906', assigns['result']['numTestFailures']
- assert_equal '1079', assigns['result']['numTestPasses']
- assert_equal '1027', assigns['result']['numCommandFailures']
- assert_equal '57', assigns['result']['numCommandErrors']
- assert_equal '3', assigns['result']['numCommandPasses']
- assert_equal 'A long time', assigns['result']['totalTime']
- end
-end
diff --git a/vendor/plugins/selenium-on-rails/test/selenium_on_rails_config_test.rb b/vendor/plugins/selenium-on-rails/test/selenium_on_rails_config_test.rb
deleted file mode 100644
index 61f80834..00000000
--- a/vendor/plugins/selenium-on-rails/test/selenium_on_rails_config_test.rb
+++ /dev/null
@@ -1,43 +0,0 @@
-require File.dirname(__FILE__) + '/test_helper'
-require 'mocha'
-
-class SeleniumOnRailsConfig
- def self.reset_config
- @@configs = nil
- end
-end
-
-class SeleniumOnRailsConfigTest < Test::Unit::TestCase
-
- def setup
- SeleniumOnRailsConfig.reset_config
- @selenium_file = File.join(RAILS_ROOT, 'config', 'selenium.yml')
- @config_file = File.expand_path(File.dirname(__FILE__) + '/../config.yml')
- @selenium_content = File.read(File.dirname(__FILE__) + '/fixtures/selenium.yml')
- @config_content = File.read(File.dirname(__FILE__) + '/fixtures/config.yml')
- end
-
- def test_get_selenium_yaml
- File.expects(:exist?).with(@selenium_file).returns(true)
- IO.expects(:read).with(@selenium_file).returns(@selenium_content)
- IO.expects(:read).with(@config_file).never
- IO.expects(:exist?).with(@config_file).never
-
- assert_equal ["test_cache"], SeleniumOnRailsConfig.get(:environments)
- assert_equal({"firefox"=>"script/openfirefox"}, SeleniumOnRailsConfig.get(:browsers))
- end
-
- def test_get_when_config_yml_exists_but_selenium_yaml_not
- File.expects(:exist?).with(@selenium_file).returns(false)
- File.expects(:exist?).with(@config_file).returns(true)
- IO.expects(:read).with(@config_file).returns(@config_content)
- IO.expects(:read).with(@selenium_file).never
-
- assert_equal ["test"], SeleniumOnRailsConfig.get(:environments)
- expected_config = {"safari"=>"/Applications/Safari.app/Contents/MacOS/Safari",
- "firefox"=>"/Applications/Firefox.app/Contents/MacOS/firefox-bin"}
-
- assert_equal(expected_config, SeleniumOnRailsConfig.get(:browsers))
- end
-
-end
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/test/selenium_support_test.rb b/vendor/plugins/selenium-on-rails/test/selenium_support_test.rb
deleted file mode 100644
index 5fb469e4..00000000
--- a/vendor/plugins/selenium-on-rails/test/selenium_support_test.rb
+++ /dev/null
@@ -1,35 +0,0 @@
-require File.dirname(__FILE__) + '/test_helper'
-
-class SeleniumSupportTest < Test::Unit::TestCase
- def setup
- @controller = SeleniumController.new
- @controller.extend(SeleniumOnRails::PathsTestHelper)
- ActionController::Routing::Routes.draw
- @request = ActionController::TestRequest.new
- @response = ActionController::TestResponse.new
- end
-
- def test_route
- get :support_file, :filename => 'TestRunner.html' #initialize the controller
- assert_equal 'http://test.host/selenium/TestRunner.html',
- @controller.url_for(:controller => 'selenium', :action => 'support_file', :filename => 'TestRunner.html')
- end
-
- def test_test_runner_existance
- get :support_file, :filename => 'TestRunner.html'
- assert_response :success
- assert @response.body.include?('Selenium')
- end
-
- def test_default_file
- get :support_file, :filename => ''
- assert_redirected_to :filename => 'TestRunner.html', :test => 'tests'
- end
-
- def test_missing_file
- get :support_file, :filename => 'missing.html'
- assert_response 404
- assert_equal 'Not found', @response.body
- end
-
-end
diff --git a/vendor/plugins/selenium-on-rails/test/setup_test.rb b/vendor/plugins/selenium-on-rails/test/setup_test.rb
deleted file mode 100644
index c24c4869..00000000
--- a/vendor/plugins/selenium-on-rails/test/setup_test.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-require File.dirname(__FILE__) + '/test_helper'
-require 'mocha'
-RAILS_ROOT = File.expand_path(File.dirname(__FILE__) + "/")
-
-class SetupTest < Test::Unit::TestCase
- def setup
- @controller = SeleniumController.new
- @controller.extend(SeleniumOnRails::PathsTestHelper)
- SeleniumController.any_instance.stubs(:clear_tables).returns([])
- SeleniumController.any_instance.stubs(:layout_path).returns(false)
- ActionController::Routing::Routes.draw
- @request = ActionController::TestRequest.new
- @response = ActionController::TestResponse.new
- end
-
- def test_session_reset
- @request.session['key'] = 'value'
- get :setup
- assert_nil session['key']
- assert_response :success
- assert_tag :content => 'The session is wiped clean.'
- end
-
- def test_session_no_reset
- @request.session['key'] = 'value'
- get :setup, :keep_session => true
- assert_equal 'value', session['key']
- assert_response :success
- assert_no_tag :content => 'The session is wiped clean.'
- end
-end
diff --git a/vendor/plugins/selenium-on-rails/test/suite_renderer_test.rb b/vendor/plugins/selenium-on-rails/test/suite_renderer_test.rb
deleted file mode 100644
index 92f9c2f3..00000000
--- a/vendor/plugins/selenium-on-rails/test/suite_renderer_test.rb
+++ /dev/null
@@ -1,109 +0,0 @@
-require File.dirname(__FILE__) + '/test_helper'
-
-class SuiteRendererTest < Test::Unit::TestCase
- def setup
- @controller = SeleniumController.new
- @controller.extend(SeleniumOnRails::PathsTestHelper)
- ActionController::Routing::Routes.draw
- @request = ActionController::TestRequest.new
- @response = ActionController::TestResponse.new
- @controller.layout_override =<test layout
-@content_for_layout
-
-END
- end
-
- def test_empty_suite
- get :test_file, :testname => 'empty_suite'
-
- assert_response :success
- assert_tag :tag => "title", :content => "test layout"
- assert_tag :tag => "script", :attributes => {:type => "text/javascript"}
- assert_tag :tag => "select", :attributes => {:onchange => "openSuite(this)"},
- :descendant => {:tag => "option", :attributes => {:value => "header"}, :content => "Suites:"},
- :descendant => {:tag => "option", :attributes => {:value => ""}, :content => ".."}
-
- assert_tag :tag => "table",
- :descendant => {:tag => "th", :content => "Empty suite"}
- end
-
- def test_root_suite
- _test_root_suite ''
- end
-
- def test_test_suite_html
- #TestSuite.html is the default name the Selenium Runner tries to run
- _test_root_suite 'TestSuite.html'
- end
-
- def _test_root_suite testname
- get :test_file, :testname => testname
- assert_response :success
-
- assert_tag :tag => "title", :content => "test layout"
- assert_tag :tag => "script", :attributes => {:type => "text/javascript"}
- assert_tag :tag => "select", :attributes => {:onchange => "openSuite(this)"},
- :descendant => {:tag => "option", :attributes => {:value => "header"}, :content => "Suites:"},
- :descendant => {:tag => "option", :attributes => {:value => "/partials"}, :content => "Partials"},
- :descendant => {:tag => "option", :attributes => {:value => "/suite_one"}, :content => "Suite one"},
- :descendant => {:tag => "option", :attributes => {:value => "/suite_two"}, :content => "Suite two"},
- :descendant => {:tag => "option", :attributes => {:value => "/suite_one/subsuite"}, :content => "Suite one.Subsuite"}
-
- assert_tag :tag => "table",
- :descendant => {:tag => "th", :content => "All test cases"},
- :descendant => {:tag => "td", :content => "Html"},
- :descendant => {:tag => "td", :content => "Own layout"},
- :descendant => {:tag => "td", :content => "Rhtml"},
- :descendant => {:tag => "td", :content => "Rselenese"},
- :descendant => {:tag => "td", :content => "Selenese"},
- :descendant => {:tag => "td", :content => "Partials.All partials"},
- :descendant => {:tag => "td", :content => "Suite one.Suite one testcase1"},
- :descendant => {:tag => "td", :content => "Suite one.Suite one testcase2"},
- :descendant => {:tag => "td", :content => "Suite one.Subsuite.Suite one subsuite testcase"},
- :descendant => {:tag => "td", :content => "Suite two.Suite two testcase"}
- end
-
- def test_suite_one
- get :test_file, :testname => 'suite_one'
-
- assert_response :success
- assert_tag :tag => "title", :content => "test layout"
- assert_tag :tag => "script", :attributes => {:type => "text/javascript"}
- assert_tag :tag => "select", :attributes => {:onchange => "openSuite(this)"},
- :descendant => {:tag => "option", :attributes => {:value => "header"}, :content => "Suites:"},
- :descendant => {:tag => "option", :attributes => {:value => ""}, :content => ".."},
- :descendant => {:tag => "option", :attributes => {:value => "/suite_one/subsuite"}, :content => "Subsuite"}
-
- assert_tag :tag => "table",
- :descendant => {:tag => "th", :content => "Suite one"},
- :descendant => {:tag => "td", :content => "Suite one testcase1"},
- :descendant => {:tag => "td", :content => "Suite one testcase2"},
- :descendant => {:tag => "td", :content => "Subsuite.Suite one subsuite testcase"}
- end
-
- def test_sub_suite
- get :test_file, :testname => 'suite_one/subsuite'
-
- assert_response :success
- assert_tag :tag => "title", :content => "test layout"
- assert_tag :tag => "script", :attributes => {:type => "text/javascript"}
- assert_tag :tag => "select", :attributes => {:onchange => "openSuite(this)"},
- :descendant => {:tag => "option", :attributes => {:value => "header"}, :content => "Suites:"},
- :descendant => {:tag => "option", :attributes => {:value => "/suite_one"}, :content => ".."}
-
- assert_tag :tag => "table",
- :descendant => {:tag => "th", :content => "Subsuite"},
- :descendant => {:tag => "td", :content => "Suite one subsuite testcase"}
- end
-
- def test_missing_tests_directory
- def @controller.selenium_tests_path
- File.join(File.dirname(__FILE__), 'invalid')
- end
- get :test_file, :testname => ''
- assert_response 404
- assert_equal "Did not find the Selenium tests path (#{File.join(File.dirname(__FILE__), 'invalid')}). Run script/generate selenium", @response.body
- end
-
-end
diff --git a/vendor/plugins/selenium-on-rails/test/switch_environment_controller_test.rb b/vendor/plugins/selenium-on-rails/test/switch_environment_controller_test.rb
deleted file mode 100644
index 66d5ac77..00000000
--- a/vendor/plugins/selenium-on-rails/test/switch_environment_controller_test.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-require File.dirname(__FILE__) + '/test_helper'
-require 'mocha'
-require 'controllers/switch_environment_controller'
-
-class SwitchEnvironmentControllerTest < Test::Unit::TestCase
-
- def setup
- @config = mock()
- setup_controller_test(SwitchEnvironmentController)
- end
-
- def test_index
- SeleniumOnRailsConfig.expects(:get).with(:environments).returns("hello dolly")
- get :index
- assert @response.body.include?('hello dolly')
- end
-end
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/test/test_builder_functions_authortest.rb b/vendor/plugins/selenium-on-rails/test/test_builder_functions_authortest.rb
deleted file mode 100644
index be1ea33c..00000000
--- a/vendor/plugins/selenium-on-rails/test/test_builder_functions_authortest.rb
+++ /dev/null
@@ -1,51 +0,0 @@
-#----------------------------------------------------------------------------
-# This is a *_authortest.rb file, which means it will only run if you run:
-# rake alltests
-# It is not run as part of the standard test suite, as it's of limited
-# value unless you're actually developing Selenium On Rails.
-
-#----------------------------------------------------------------------------
-# The test_builder_actions.rb and test_builder_accessors.rb files do not
-# necessarily contain all the functions which are available in Selenium.
-# Here we use the iedoc.xml file to find functions which might need to be
-# added to the files. Ultimately it would be great not to need to do this
-# process manually, however, this is a temporary step toward improving
-# function parity.
-
-require File.dirname(__FILE__) + '/test_helper'
-
-class TestTheTestBuilderFunctions < Test::Unit::TestCase
-
- def test_functions_in_iedoc_are_supported
-
- base_path = File.dirname(__FILE__) + '/../'
-
- iedoc_file = File.read base_path + "selenium-core/iedoc.xml"
- test_builder_actions_file = File.read base_path + "lib/selenium_on_rails/test_builder_actions.rb"
- test_builder_accessors_file = File.read base_path + "lib/selenium_on_rails/test_builder_accessors.rb"
-
- # Don't include any deprecated functions
- deprecated_functions = %W{dragdrop}
-
- iedoc_functions = iedoc_file.scan(/function *name *= *["']([a-zA-Z]+)["']/)\
- .sort.collect{|x| x[0]} - deprecated_functions
-
- for function_name in iedoc_functions
-
- function_name.gsub!(/[A-Z]/) { |s| "_" + s.downcase }
-
- test_description = "The function listed in the iedoc.xml file, " +
- "#{function_name}, exists in the test_builder files"
-
- if test_builder_actions_file.match(/def *#{function_name}/) ||
- test_builder_accessors_file.match(/(?:def *|tt>)#{function_name}/)
- assert true, test_description
- else
- assert false, test_description
- end
- end
-
- end
-
-end
-
diff --git a/vendor/plugins/selenium-on-rails/test/test_helper.rb b/vendor/plugins/selenium-on-rails/test/test_helper.rb
deleted file mode 100644
index cac9efee..00000000
--- a/vendor/plugins/selenium-on-rails/test/test_helper.rb
+++ /dev/null
@@ -1,101 +0,0 @@
-ENV["RAILS_ENV"] = "test"
-RAILS_ROOT = "test" unless defined?(RAILS_ROOT)
-$: << File.expand_path(File.dirname(__FILE__) + "/../lib")
-
-require 'rubygems'
-gem 'activesupport'
-require 'active_support'
-
-gem 'actionpack'
-require 'action_view/template_handler'
-require 'action_view/template_handlers/builder'
-require 'action_view/template_handlers/erb'
-require 'action_view/template_handlers/rjs'
-require 'action_view/base'
-require 'action_view/partials'
-require 'action_view/template_error'
-require 'action_controller'
-
-require 'selenium_on_rails/suite_renderer'
-require 'selenium_on_rails/fixture_loader'
-require 'selenium_helper'
-require 'controllers/selenium_controller'
-require File.expand_path(File.dirname(__FILE__) + "/../routes")
-require 'action_controller/test_process'
-
-SeleniumController.append_view_path File.expand_path(File.dirname(__FILE__))
-
-def setup_controller_test(controller)
- @controller = controller.new
- ActionController::Routing::Routes.draw
- @request = ActionController::TestRequest.new
- @response = ActionController::TestResponse.new
-end
-
-
-class SeleniumController
- attr_accessor :layout_override
- # Re-raise errors caught by the controller.
- def rescue_action e
- raise e
- end
-
- def render options = nil
- if override_layout? options
- options[:layout] = false
- super options
- return response.body = @layout_override.gsub('@content_for_layout', response.body)
- end
- super options
- end
-
- private
- def override_layout? options
- return false unless @layout_override
- if options[:action] or options[:template]
- options[:layout] != false #for action and template the default layout is used if not explicitly disabled
- else
- not [nil, false].include? options[:layout] #otherwise a layout has to be specified
- end
- end
-
-end
-
-class Test::Unit::TestCase
- def assert_text_equal expected, actual
- assert_equal clean_text(expected), clean_text(actual)
- end
-
- def clean_text text
- text.gsub("\t", ' ').gsub("\r", '').gsub("\n", '').gsub(/ *, '<')
- end
-
-end
-
-module SeleniumOnRails::PathsTestHelper
- def selenium_tests_path
- File.expand_path(File.dirname(__FILE__) + '/../test_data')
- end
-end
-
-class TestView < ActionView::Base
- include SeleniumOnRails::PartialsSupport
-
- # alias_method :render_partial_without_override, :render_partial
- # def render_partial partial_path = default_template_name, object = nil, local_assigns = nil, status = nil
- # if @override
- # partial = render :inline => @override, :type => @override_type, :locals => local_assigns
- # extract_commands_from_partial partial
- # else
- # render_partial_without_override partial_path, object, local_assigns, status
- # end
- # end
- #
- # def override_partial partial, type
- # @override, @override_type = partial, type
- # result = yield
- # @override, @override_type = nil, nil
- # result
- # end
-
-end
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/test_data/_partial.rsel b/vendor/plugins/selenium-on-rails/test_data/_partial.rsel
deleted file mode 100644
index d6c575a7..00000000
--- a/vendor/plugins/selenium-on-rails/test_data/_partial.rsel
+++ /dev/null
@@ -1 +0,0 @@
-assert_title "Partial from #{source}"
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/test_data/backup.html~ b/vendor/plugins/selenium-on-rails/test_data/backup.html~
deleted file mode 100644
index e69de29b..00000000
diff --git a/vendor/plugins/selenium-on-rails/test_data/own_layout.html b/vendor/plugins/selenium-on-rails/test_data/own_layout.html
deleted file mode 100644
index a45c5498..00000000
--- a/vendor/plugins/selenium-on-rails/test_data/own_layout.html
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
- Test case with own layout
-
-
-
-
- | Test own layout |
- | open | /selenium/setup | |
-
-
-
diff --git a/vendor/plugins/selenium-on-rails/test_data/partials/_html.html b/vendor/plugins/selenium-on-rails/test_data/partials/_html.html
deleted file mode 100644
index 916ca4f7..00000000
--- a/vendor/plugins/selenium-on-rails/test_data/partials/_html.html
+++ /dev/null
@@ -1,6 +0,0 @@
-This should never be visible!
-
- | HTML partial |
- | type | partial | HTML partial |
-
-Neither should this!
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/test_data/partials/_nesting.rsel b/vendor/plugins/selenium-on-rails/test_data/partials/_nesting.rsel
deleted file mode 100644
index 28e7bf91..00000000
--- a/vendor/plugins/selenium-on-rails/test_data/partials/_nesting.rsel
+++ /dev/null
@@ -1,2 +0,0 @@
-type 'nesting', 'Nesting partial'
-include_partial 'partials/rsel', :hello => hello.reverse
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/test_data/partials/_rhtml.rhtml b/vendor/plugins/selenium-on-rails/test_data/partials/_rhtml.rhtml
deleted file mode 100644
index af6599de..00000000
--- a/vendor/plugins/selenium-on-rails/test_data/partials/_rhtml.rhtml
+++ /dev/null
@@ -1,6 +0,0 @@
-This should never be visible!
-
- | RHTML partial |
- | type | <%= hello %> | RHTML partial |
-
-Neither should this!
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/test_data/partials/_rsel.rsel b/vendor/plugins/selenium-on-rails/test_data/partials/_rsel.rsel
deleted file mode 100644
index 0ce0e9fe..00000000
--- a/vendor/plugins/selenium-on-rails/test_data/partials/_rsel.rsel
+++ /dev/null
@@ -1 +0,0 @@
-type hello, 'RSelenese partial'
diff --git a/vendor/plugins/selenium-on-rails/test_data/partials/_sel.sel b/vendor/plugins/selenium-on-rails/test_data/partials/_sel.sel
deleted file mode 100644
index 353f0f26..00000000
--- a/vendor/plugins/selenium-on-rails/test_data/partials/_sel.sel
+++ /dev/null
@@ -1,5 +0,0 @@
-h1. This should not be visible!
-
-|type|partial|Selenese partial|
-
-p. Neither should this!
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/test_data/partials/all_partials.rsel b/vendor/plugins/selenium-on-rails/test_data/partials/all_partials.rsel
deleted file mode 100644
index 08c0faf5..00000000
--- a/vendor/plugins/selenium-on-rails/test_data/partials/all_partials.rsel
+++ /dev/null
@@ -1,5 +0,0 @@
-include_partial 'partial', :source => title
-['html', 'rhtml', 'sel', 'rsel'].each do |format|
- include_partial "partials/#{format}", :hello => 'world'
-end
-include_partial 'partials/nesting', :hello => 'world'
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/test_data/rhtml.rhtml b/vendor/plugins/selenium-on-rails/test_data/rhtml.rhtml
deleted file mode 100644
index 2ae4e413..00000000
--- a/vendor/plugins/selenium-on-rails/test_data/rhtml.rhtml
+++ /dev/null
@@ -1,7 +0,0 @@
-
- | <%= @page_title %> |
-<% for page in ['/fi', '/fo', '/fum'] -%>
- | open | <%= page %> | |
-<% end -%>
- <%= render :partial => 'partial', :locals => {:source => 'RHTML'} %>
-
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/test_data/rselenese.rsel b/vendor/plugins/selenium-on-rails/test_data/rselenese.rsel
deleted file mode 100644
index 425d75e6..00000000
--- a/vendor/plugins/selenium-on-rails/test_data/rselenese.rsel
+++ /dev/null
@@ -1,8 +0,0 @@
-setup
-setup :keep_session
-test.setup :fixtures => :all
-setup :fixtures => [:foo, 'bar']
-setup :clear_tables => [:foo, :bar], :fixtures => :all
-assert_absolute_location :controller => 'selenium', :action => 'setup' #urls must be tested with a controller
-assert_title @view.controller.controller_name #make sure we can access the view easily
-include_partial 'partial', :source => 'RSelenese'
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/test_data/selenese.sel b/vendor/plugins/selenium-on-rails/test_data/selenese.sel
deleted file mode 100644
index 46b1dce9..00000000
--- a/vendor/plugins/selenium-on-rails/test_data/selenese.sel
+++ /dev/null
@@ -1,7 +0,0 @@
-Selenese *support*
-
-|open|/selenium/setup|
-|goBack|
-|includePartial|partial|source=Selenese|
-
-works.
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/test_data/suite_one/subsuite/suite_one_subsuite_testcase.sel b/vendor/plugins/selenium-on-rails/test_data/suite_one/subsuite/suite_one_subsuite_testcase.sel
deleted file mode 100644
index 9c3209b6..00000000
--- a/vendor/plugins/selenium-on-rails/test_data/suite_one/subsuite/suite_one_subsuite_testcase.sel
+++ /dev/null
@@ -1 +0,0 @@
-|open|/|
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/test_data/suite_one/suite_one_testcase1.sel b/vendor/plugins/selenium-on-rails/test_data/suite_one/suite_one_testcase1.sel
deleted file mode 100644
index 9c3209b6..00000000
--- a/vendor/plugins/selenium-on-rails/test_data/suite_one/suite_one_testcase1.sel
+++ /dev/null
@@ -1 +0,0 @@
-|open|/|
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/test_data/suite_one/suite_one_testcase2.sel b/vendor/plugins/selenium-on-rails/test_data/suite_one/suite_one_testcase2.sel
deleted file mode 100644
index 9c3209b6..00000000
--- a/vendor/plugins/selenium-on-rails/test_data/suite_one/suite_one_testcase2.sel
+++ /dev/null
@@ -1 +0,0 @@
-|open|/|
\ No newline at end of file
diff --git a/vendor/plugins/selenium-on-rails/test_data/suite_two/suite_two_testcase.sel b/vendor/plugins/selenium-on-rails/test_data/suite_two/suite_two_testcase.sel
deleted file mode 100644
index 9c3209b6..00000000
--- a/vendor/plugins/selenium-on-rails/test_data/suite_two/suite_two_testcase.sel
+++ /dev/null
@@ -1 +0,0 @@
-|open|/|
\ No newline at end of file
diff --git a/vendor/plugins/swf_fu/README.rdoc b/vendor/plugins/swf_fu/README.rdoc
index 3a7ad555..1791f1ff 100644
--- a/vendor/plugins/swf_fu/README.rdoc
+++ b/vendor/plugins/swf_fu/README.rdoc
@@ -48,6 +48,7 @@ You can specify alternate content either with the options :alt => "Get Flash
* :mode - Either :dynamic (default) or :static. Refer to SWFObject's doc[http://code.google.com/p/swfobject/wiki/documentation#Should_I_use_the_static_or_dynamic_publishing_method?]
* :flashvars - a Hash of variables that are passed to the swf. Can also be a string like "foo=bar&hello=world". Defaults to {:id => the DOM id}
* :parameters - a Hash of configuration parameters for the swf. See Adobe's doc[http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_12701#optional]
+* :html_options - a Hash of extra html options for the object tag.
* :alt - HTML text that is displayed when the Flash player is not available. Defaults to a "Get Flash" image pointing to Adobe Flash's installation page. This can also be specified as a block (see embedding section). In Rails 3, this text is _assumed_ to be HTML, so there is no need to call +html_safe+ on it.
* :flash_version - the version of the Flash player that is required (e.g. "7" (default) or "8.1.0")
* :auto_install - a swf file that will upgrade flash player if needed (defaults to "expressInstall" which was installed by +swf_fu+)
diff --git a/vendor/plugins/swf_fu/init.rb b/vendor/plugins/swf_fu/init.rb
index f2d3a4ff..0928716d 100644
--- a/vendor/plugins/swf_fu/init.rb
+++ b/vendor/plugins/swf_fu/init.rb
@@ -1,4 +1,4 @@
-require 'action_view/helpers/asset_tag_helper'
+ActionView::Helpers::AssetTagHelper rescue require 'action_view/helpers/asset_tag_helper' # Might be needed in some testing environments
require File.dirname(__FILE__) + "/lib/action_view/helpers/swf_fu_helper"
require File.dirname(__FILE__) + "/lib/action_view/helpers/asset_tag_helper/swf_asset"
@@ -7,4 +7,8 @@ ActionView::Helpers.class_eval { include ActionView::Helpers::SwfFuHelper } # F
ActionView::Base.class_eval { include ActionView::Helpers::SwfFuHelper } # ...and for older ones
ActionView::TestCase.class_eval { include ActionView::Helpers::SwfFuHelper } if defined? ActionView::TestCase # ...for tests in older versions
-ActionView::Helpers::AssetTagHelper.register_javascript_include_default 'swfobject'
\ No newline at end of file
+begin
+ ActionView::Helpers::AssetTagHelper.register_javascript_expansion :default => ["swfobject"]
+rescue NoMethodError # I think this might fail in Rails 2.1.x
+ ActionView::Helpers::AssetTagHelper.register_javascript_include_default 'swfobject'
+end
diff --git a/vendor/plugins/swf_fu/lib/action_view/helpers/swf_fu_helper.rb b/vendor/plugins/swf_fu/lib/action_view/helpers/swf_fu_helper.rb
index 5c1ab960..3c05807c 100644
--- a/vendor/plugins/swf_fu/lib/action_view/helpers/swf_fu_helper.rb
+++ b/vendor/plugins/swf_fu/lib/action_view/helpers/swf_fu_helper.rb
@@ -68,7 +68,9 @@ module ActionView #:nodoc:
end
options.reverse_merge!(DEFAULTS)
options[:id] ||= source.gsub(/^.*\//, '').gsub(/\.swf$/,'')
+ options[:id] = force_to_valid_id(options[:id])
options[:div_id] ||= options[:id]+"_div"
+ options[:div_id] = force_to_valid_id(options[:div_id])
options[:width], options[:height] = options[:size].scan(/^(\d*%?)x(\d*%?)$/).first if options[:size]
options[:auto_install] &&= @view.swf_path(options[:auto_install])
options[:flashvars][:id] ||= options[:id]
@@ -79,10 +81,18 @@ module ActionView #:nodoc:
end
end
+ def force_to_valid_id(id)
+ id = id.gsub /[^A-Za-z0-9\-_]/, "_" # HTML id can only contain these characters
+ id = "swf_" + id unless id =~ /^[A-Z]/i # HTML id must start with alpha
+ id
+ end
+
def generate(&block)
if block_given?
@options[:alt] = @view.capture(&block)
- if Rails::VERSION::STRING < "2.2"
+ if Rails::VERSION::STRING >= "3.0"
+ send(@mode)
+ elsif Rails::VERSION::STRING < "2.2"
@view.concat(send(@mode), block.binding)
else
@view.concat(send(@mode))
@@ -184,4 +194,4 @@ module ActionView #:nodoc:
end #class Generator
end
end
-end
\ No newline at end of file
+end
diff --git a/vendor/plugins/swf_fu/test/swf_fu_test.rb b/vendor/plugins/swf_fu/test/swf_fu_test.rb
index f017e29f..64a2a8bf 100644
--- a/vendor/plugins/swf_fu/test/swf_fu_test.rb
+++ b/vendor/plugins/swf_fu/test/swf_fu_test.rb
@@ -118,6 +118,13 @@ class SwfFuTest < ActionView::TestCase
end
+ should "enforce HTML id validity" do
+ div_result = ''
+ assert_match /#{div_result}/, swf_tag("123-456_ok$!+X")
+ obj_result = '"id":"swf_123-456_ok___X"'
+ assert_match /#{obj_result}/, swf_tag("123-456_ok$!+X")
+ end
+
should "treat initialize arrays as list of parameters" do
assert_match 'initialize("hello","world")', swf_tag("mySwf", :initialize => ["hello", "world"], :javascript_class => "SomeClass")
end
diff --git a/vendor/plugins/yaml_db/README b/vendor/plugins/yaml_db/README
deleted file mode 100644
index 6a484569..00000000
--- a/vendor/plugins/yaml_db/README
+++ /dev/null
@@ -1,33 +0,0 @@
-= YamlDb
-
-YamlDb is a database-independent format for dumping and restoring data. It complements the the database-independent schema format found in db/schema.rb. The data is saved into db/data.yml.
-
-This can be used as a replacement for mysqldump or pg_dump, but only for the databases typically used by Rails apps. Users, permissions, schemas, triggers, and other advanced database features are not supported - by design.
-
-Any database that has an ActiveRecord adapter should work.
-
-== Usage
-
-rake db:data:dump -> Dump contents of Rails database to db/data.yml
-rake db:data:load -> Load contents of db/data.yml into the database
-
-Further, there are tasks db:dump and db:load which do the entire database (the equivalent of running db:schema:dump followed by db:data:load).
-
-== Examples
-
-One common use would be to switch your data from one database backend to another. For example, let's say you wanted to switch from SQLite to MySQL. You might execute the following steps:
-
-1. rake db:dump
-
-2. Edit config/database.yml and change your adapter to mysql, set up database params
-
-3. mysqladmin create [database name]
-
-4. rake db:load
-
-== Credits
-
-Created by Orion Henry and Adam Wiggins. Major updates by Ricardo Chimal, Jr. Patches contributed by Michael Irwin.
-
-Send questions, feedback, or patches to the Heroku mailing list: http://groups.google.com/group/heroku
-
diff --git a/vendor/plugins/yaml_db/Rakefile b/vendor/plugins/yaml_db/Rakefile
deleted file mode 100644
index 3742f1cd..00000000
--- a/vendor/plugins/yaml_db/Rakefile
+++ /dev/null
@@ -1,10 +0,0 @@
-require 'rake'
-require 'spec/rake/spectask'
-
-desc "Run all specs"
-Spec::Rake::SpecTask.new('spec') do |t|
- t.spec_files = FileList['spec/*_spec.rb']
-end
-
-task :default => :spec
-
diff --git a/vendor/plugins/yaml_db/about.yml b/vendor/plugins/yaml_db/about.yml
deleted file mode 100644
index 764d26bb..00000000
--- a/vendor/plugins/yaml_db/about.yml
+++ /dev/null
@@ -1,5 +0,0 @@
-author: Orion Henry and Adam Wiggins of Heroku
-summary: Dumps and loads a database-independent data dump format in db/data.yml.
-homepage: http://opensource.heroku.com/
-license: MIT
-rails_version: 1.2+
diff --git a/vendor/plugins/yaml_db/init.rb b/vendor/plugins/yaml_db/init.rb
deleted file mode 100644
index e19a0d54..00000000
--- a/vendor/plugins/yaml_db/init.rb
+++ /dev/null
@@ -1 +0,0 @@
-require 'yaml_db'
diff --git a/vendor/plugins/yaml_db/lib/yaml_db.rb b/vendor/plugins/yaml_db/lib/yaml_db.rb
deleted file mode 100644
index 6e7e7b3b..00000000
--- a/vendor/plugins/yaml_db/lib/yaml_db.rb
+++ /dev/null
@@ -1,170 +0,0 @@
-require 'rubygems'
-require 'yaml'
-require 'active_record'
-
-
-module YamlDb
- def self.dump(filename)
- disable_logger
- YamlDb::Dump.dump(File.new(filename, "w"))
- reenable_logger
- end
-
- def self.load(filename)
- disable_logger
- YamlDb::Load.load(File.new(filename, "r"))
- reenable_logger
- end
-
- def self.disable_logger
- @@old_logger = ActiveRecord::Base.logger
- ActiveRecord::Base.logger = nil
- end
-
- def self.reenable_logger
- ActiveRecord::Base.logger = @@old_logger
- end
-end
-
-
-module YamlDb::Utils
- def self.chunk_records(records)
- yaml = [ records ].to_yaml
- yaml.sub!("--- \n", "")
- yaml.sub!('- - -', ' - -')
- yaml
- end
-
- def self.unhash(hash, keys)
- keys.map { |key| hash[key] }
- end
-
- def self.unhash_records(records, keys)
- records.each_with_index do |record, index|
- records[index] = unhash(record, keys)
- end
-
- records
- end
-
- def self.convert_booleans(records, columns)
- records.each do |record|
- columns.each do |column|
- next if is_boolean(record[column])
- record[column] = (record[column] == 't' or record[column] == '1')
- end
- end
- records
- end
-
- def self.boolean_columns(table)
- columns = ActiveRecord::Base.connection.columns(table).reject { |c| c.type != :boolean }
- columns.map { |c| c.name }
- end
-
- def self.is_boolean(value)
- value.kind_of?(TrueClass) or value.kind_of?(FalseClass)
- end
-end
-
-
-module YamlDb::Dump
- def self.dump(io)
- ActiveRecord::Base.connection.tables.each do |table|
- dump_table(io, table)
- end
- end
-
- def self.dump_table(io, table)
- return if table_record_count(table).zero?
-
- dump_table_columns(io, table)
- dump_table_records(io, table)
- end
-
- def self.dump_table_columns(io, table)
- io.write("\n")
- io.write({ table => { 'columns' => table_column_names(table) } }.to_yaml)
- end
-
- def self.dump_table_records(io, table)
- table_record_header(io)
-
- column_names = table_column_names(table)
-
- each_table_page(table) do |records|
- rows = YamlDb::Utils.unhash_records(records, column_names)
- io.write(YamlDb::Utils.chunk_records(records))
- end
- end
-
- def self.table_record_header(io)
- io.write(" records: \n")
- end
-
- def self.table_column_names(table)
- ActiveRecord::Base.connection.columns(table).map { |c| c.name }
- end
-
- def self.each_table_page(table, records_per_page=1000)
- total_count = table_record_count(table)
- pages = (total_count.to_f / records_per_page).ceil - 1
- id = table_column_names(table).first
- boolean_columns = YamlDb::Utils.boolean_columns(table)
-
- (0..pages).to_a.each do |page|
- sql_limit = "LIMIT #{records_per_page} OFFSET #{records_per_page*page}"
- records = ActiveRecord::Base.connection.select_all("SELECT * FROM #{table} ORDER BY #{id} #{sql_limit}")
- records = YamlDb::Utils.convert_booleans(records, boolean_columns)
- yield records
- end
- end
-
- def self.table_record_count(table)
- ActiveRecord::Base.connection.select_one("SELECT COUNT(*) FROM #{table}").values.first.to_i
- end
-end
-
-
-module YamlDb::Load
- def self.load(io)
- ActiveRecord::Base.connection.transaction do
- YAML.load_documents(io) do |ydoc|
- ydoc.keys.each do |table_name|
- next if ydoc[table_name].nil?
- load_table(table_name, ydoc[table_name])
- end
- end
- end
- end
-
- def self.truncate_table(table)
- begin
- ActiveRecord::Base.connection.execute("TRUNCATE #{table}")
- rescue Exception
- ActiveRecord::Base.connection.execute("DELETE FROM #{table}")
- end
- end
-
- def self.load_table(table, data)
- column_names = data['columns']
- truncate_table(table)
- load_records(table, column_names, data['records'])
- # Uncomment if using PostgreSQL
- # reset_pk_sequence!(table)
- end
-
- def self.load_records(table, column_names, records)
- quoted_column_names = column_names.map { |column| ActiveRecord::Base.connection.quote_column_name(column) }.join(',')
- records.each do |record|
- ActiveRecord::Base.connection.execute("INSERT INTO #{table} (#{quoted_column_names}) VALUES (#{record.map { |r| ActiveRecord::Base.connection.quote(r) }.join(',')})")
- end
- end
-
- # Uncomment if using PostgreSQL
- # def self.reset_pk_sequence!(table_name)
- # if ActiveRecord::Base.connection.kind_of?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter)
- # ActiveRecord::Base.connection.reset_pk_sequence!(table_name)
- # end
- # end
-end
diff --git a/vendor/plugins/yaml_db/spec/base.rb b/vendor/plugins/yaml_db/spec/base.rb
deleted file mode 100644
index ef6c1744..00000000
--- a/vendor/plugins/yaml_db/spec/base.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-require 'rubygems'
-require 'spec'
-
-$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../lib')
-require 'yaml_db'
-
-
diff --git a/vendor/plugins/yaml_db/spec/yaml_dump_spec.rb b/vendor/plugins/yaml_db/spec/yaml_dump_spec.rb
deleted file mode 100644
index 95f5a487..00000000
--- a/vendor/plugins/yaml_db/spec/yaml_dump_spec.rb
+++ /dev/null
@@ -1,89 +0,0 @@
-require File.dirname(__FILE__) + '/base'
-
-describe YamlDb::Dump do
- before do
- File.stub!(:new).with('dump.yml', 'w').and_return(StringIO.new)
-
- ActiveRecord::Base = mock('ActiveRecord::Base', :null_object => true)
- ActiveRecord::Base.connection = mock('connection')
- ActiveRecord::Base.connection.stub!(:tables).and_return([ 'mytable' ])
- ActiveRecord::Base.connection.stub!(:columns).with('mytable').and_return([ mock('a',:name => 'a'), mock('b', :name => 'b') ])
- ActiveRecord::Base.connection.stub!(:select_one).and_return({"count"=>"2"})
- ActiveRecord::Base.connection.stub!(:select_all).and_return([ { 'a' => 1, 'b' => 2 }, { 'a' => 3, 'b' => 4 } ])
- end
-
- before(:each) do
- @io = StringIO.new
- end
-
- it "should return a formatted string" do
- YamlDb::Dump.table_record_header(@io)
- @io.rewind
- @io.read.should == " records: \n"
- end
-
- it "should return a list of column names" do
- YamlDb::Dump.table_column_names('mytable').should == [ 'a', 'b' ]
- end
-
- it "should return the total number of records in a table" do
- YamlDb::Dump.table_record_count('mytable').should == 2
- end
-
- it "should return a yaml string that contains a table header and column names" do
- YamlDb::Dump.stub!(:table_column_names).with('mytable').and_return([ 'a', 'b' ])
- YamlDb::Dump.dump_table_columns(@io, 'mytable')
- @io.rewind
- @io.read.should == <
1, 'b' => 2 }, { 'a' => 3, 'b' => 4 } ]
- end
- end
-
- it "should paginate records from the database and return them" do
- ActiveRecord::Base.connection.stub!(:select_all).and_return([ { 'a' => 1, 'b' => 2 } ], [ { 'a' => 3, 'b' => 4 } ])
-
- records = [ ]
- YamlDb::Dump.each_table_page('mytable', 1) do |page|
- page.size.should == 1
- records.concat(page)
- end
-
- records.should == [ { 'a' => 1, 'b' => 2 }, { 'a' => 3, 'b' => 4 } ]
- end
-
- it "should return dump the records for a table in yaml to a given io stream" do
- YamlDb::Dump.dump_table_records(@io, 'mytable')
- @io.rewind
- @io.read.should == < true)
- ActiveRecord::Base.connection = mock('connection')
- ActiveRecord::Base.connection.stub!(:transaction).and_yield
- end
-
- before(:each) do
- @io = StringIO.new
- end
-
- it "should truncate the table" do
- ActiveRecord::Base.connection.stub!(:execute).with("TRUNCATE mytable").and_return(true)
- ActiveRecord::Base.connection.should_not_receive(:execute).with("DELETE FROM mytable")
- YamlDb::Load.truncate_table('mytable')
- end
-
- it "should delete the table if truncate throws an exception" do
- ActiveRecord::Base.connection.should_receive(:execute).with("TRUNCATE mytable").and_raise()
- ActiveRecord::Base.connection.should_receive(:execute).with("DELETE FROM mytable").and_return(true)
- YamlDb::Load.truncate_table('mytable')
- end
-
- it "should insert records into a table" do
- ActiveRecord::Base.connection.stub!(:quote_column_name).with('a').and_return('a')
- ActiveRecord::Base.connection.stub!(:quote_column_name).with('b').and_return('b')
- ActiveRecord::Base.connection.stub!(:quote).with(1).and_return("'1'")
- ActiveRecord::Base.connection.stub!(:quote).with(2).and_return("'2'")
- ActiveRecord::Base.connection.stub!(:quote).with(3).and_return("'3'")
- ActiveRecord::Base.connection.stub!(:quote).with(4).and_return("'4'")
- ActiveRecord::Base.connection.should_receive(:execute).with("INSERT INTO mytable (a,b) VALUES ('1','2')")
- ActiveRecord::Base.connection.should_receive(:execute).with("INSERT INTO mytable (a,b) VALUES ('3','4')")
-
- YamlDb::Load.load_records('mytable', ['a', 'b'], [[1, 2], [3, 4]])
- end
-
- it "should quote column names that correspond to sql keywords" do
- ActiveRecord::Base.connection.stub!(:quote_column_name).with('a').and_return('a')
- ActiveRecord::Base.connection.stub!(:quote_column_name).with('count').and_return('"count"')
- ActiveRecord::Base.connection.stub!(:quote).with(1).and_return("'1'")
- ActiveRecord::Base.connection.stub!(:quote).with(2).and_return("'2'")
- ActiveRecord::Base.connection.stub!(:quote).with(3).and_return("'3'")
- ActiveRecord::Base.connection.stub!(:quote).with(4).and_return("'4'")
- ActiveRecord::Base.connection.should_receive(:execute).with("INSERT INTO mytable (a,\"count\") VALUES ('1','2')")
- ActiveRecord::Base.connection.should_receive(:execute).with("INSERT INTO mytable (a,\"count\") VALUES ('3','4')")
-
- YamlDb::Load.load_records('mytable', ['a', 'count'], [[1, 2], [3, 4]])
- end
-
- it "should truncate the table and then load the records into the table" do
- YamlDb::Load.should_receive(:truncate_table).with('mytable')
- YamlDb::Load.should_receive(:load_records).with('mytable', ['a', 'b'], [[1, 2], [3, 4]])
- YamlDb::Load.should_receive(:reset_pk_sequence!).with('mytable')
-
- YamlDb::Load.load_table('mytable', { 'columns' => [ 'a', 'b' ], 'records' => [[1, 2], [3, 4]] })
- end
-
- it "should call load structure for each document in the file" do
- YAML.should_receive(:load_documents).with(@io).and_yield({ 'mytable' => {
- 'columns' => [ 'a', 'b' ],
- 'records' => [[1, 2], [3, 4]]
- } })
- YamlDb::Load.should_receive(:load_table).with('mytable', { 'columns' => [ 'a', 'b' ], 'records' => [[1, 2], [3, 4]] })
- YamlDb::Load.load(@io)
- end
-
- it "should not call load structure when the document in the file contains no records" do
- YAML.should_receive(:load_documents).with(@io).and_yield({ 'mytable' => nil })
- YamlDb::Load.should_not_receive(:load_table)
- YamlDb::Load.load(@io)
- end
-
- it "should call reset pk sequence if the connection adapter is postgres" do
- module ActiveRecord; module ConnectionAdapters; class PostgreSQLAdapter; end; end; end;
- ActiveRecord::Base.connection.stub!(:kind_of?).with(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter).and_return(true)
- ActiveRecord::Base.connection.should_receive(:reset_pk_sequence!).with('mytable')
- YamlDb::Load.reset_pk_sequence!('mytable')
- end
-
- it "should not call reset_pk_sequence if the connection adapter is not postgres" do
- module ActiveRecord; module ConnectionAdapters; class PostgreSQLAdapter; end; end; end;
- ActiveRecord::Base.connection.stub!(:kind_of?).with(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter).and_return(false)
- ActiveRecord::Base.connection.should_not_receive(:reset_pk_sequence!)
- YamlDb::Load.reset_pk_sequence!('mytable')
- end
-end
diff --git a/vendor/plugins/yaml_db/spec/yaml_utils_spec.rb b/vendor/plugins/yaml_db/spec/yaml_utils_spec.rb
deleted file mode 100644
index 13920699..00000000
--- a/vendor/plugins/yaml_db/spec/yaml_utils_spec.rb
+++ /dev/null
@@ -1,39 +0,0 @@
-require File.dirname(__FILE__) + '/base'
-
-describe YamlDb::Utils, " convert records utility method" do
- it "turns an array with one record into a yaml chunk" do
- YamlDb::Utils.chunk_records([ %w(a b) ]).should == < 1, 'b' => 2 }, [ 'b', 'a' ]).should == [ 2, 1 ]
- end
-
- it "should unhash each hash an array using an array of ordered keys" do
- YamlDb::Utils.unhash_records([ { 'a' => 1, 'b' => 2 }, { 'a' => 3, 'b' => 4 } ], [ 'b', 'a' ]).should == [ [ 2, 1 ], [ 4, 3 ] ]
- end
-
- it "should return true if it is a boolean type" do
- YamlDb::Utils.is_boolean(true).should == true
- YamlDb::Utils.is_boolean('true').should_not == true
- end
-
- it "should return an array of boolean columns" do
- ActiveRecord::Base = mock('ActiveRecord::Base', :null_object => true)
- ActiveRecord::Base.connection = mock('connection')
- ActiveRecord::Base.connection.stub!(:columns).with('mytable').and_return([ mock('a',:name => 'a',:type => :string), mock('b', :name => 'b',:type => :boolean) ])
- YamlDb::Utils.boolean_columns('mytable').should == ['b']
- end
-end
diff --git a/vendor/plugins/yaml_db/tasks/yaml_db_tasks.rake b/vendor/plugins/yaml_db/tasks/yaml_db_tasks.rake
deleted file mode 100644
index 6851d44c..00000000
--- a/vendor/plugins/yaml_db/tasks/yaml_db_tasks.rake
+++ /dev/null
@@ -1,23 +0,0 @@
-namespace :db do
- desc "Dump schema and data to db/schema.rb and db/data.yml"
- task(:dump => [ "db:schema:dump", "db:data:dump" ])
-
- desc "Load schema and data from db/schema.rb and db/data.yml"
- task(:load => [ "db:schema:load", "db:data:load" ])
-
- namespace :data do
- def db_dump_data_file
- "#{RAILS_ROOT}/db/data.yml"
- end
-
- desc "Dump contents of database to db/data.yml"
- task(:dump => :environment) do
- YamlDb.dump db_dump_data_file
- end
-
- desc "Load contents of db/data.yml into database"
- task(:load => :environment) do
- YamlDb.load db_dump_data_file
- end
- end
-end
diff --git a/vendor/rails/actionmailer/CHANGELOG b/vendor/rails/actionmailer/CHANGELOG
deleted file mode 100644
index 59f5b187..00000000
--- a/vendor/rails/actionmailer/CHANGELOG
+++ /dev/null
@@ -1,387 +0,0 @@
-*2.3.11 (February 9, 2011)*
-*2.3.10 (October 15, 2010)*
-*2.3.9 (September 4, 2010)*
-*2.3.8 (May 24, 2010)*
-*2.3.7 (May 24, 2010)*
-
-* Version bump.
-
-
-*2.3.6 (May 23, 2010)*
-
-* Upgrade TMail from 1.2.3 to 1.2.7. [Mikel Lindsaar]
-
-
-*2.3.5 (November 25, 2009)*
-
-* Minor Bug Fixes and deprecation warnings
-
-
-*2.3.4 (September 4, 2009)*
-
-* Minor bug fixes.
-
-
-*2.3.3 (July 12, 2009)*
-
-* No changes, just a version bump.
-
-
-*2.3.2 [Final] (March 15, 2009)*
-
-* Fixed that ActionMailer should send correctly formatted Return-Path in MAIL FROM for SMTP #1842 [Matt Jones]
-
-* Fixed RFC-2045 quoted-printable bug #1421 [squadette]
-
-* Fixed that no body charset would be set when there are attachments present #740 [Paweł Kondzior]
-
-
-*2.2.1 [RC2] (November 14th, 2008)*
-
-* Turn on STARTTLS if it is available in Net::SMTP (added in Ruby 1.8.7) and the SMTP server supports it (This is required for Gmail's SMTP server) #1336 [Grant Hollingworth]
-
-
-*2.2.0 [RC1] (October 24th, 2008)*
-
-* Add layout functionality to mailers [Pratik Naik]
-
- Mailer layouts behaves just like controller layouts, except layout names need to
- have '_mailer' postfix for them to be automatically picked up.
-
-
-*2.1.0 (May 31st, 2008)*
-
-* Fixed that a return-path header would be ignored #7572 [joost]
-
-* Less verbose mail logging: just recipients for :info log level; the whole email for :debug only. #8000 [iaddict, Tarmo Tänav]
-
-* Updated TMail to version 1.2.1 [Mikel Lindsaar]
-
-* Fixed that you don't have to call super in ActionMailer::TestCase#setup #10406 [jamesgolick]
-
-
-*2.0.2* (December 16th, 2007)
-
-* Included in Rails 2.0.2
-
-
-*2.0.1* (December 7th, 2007)
-
-* Update ActionMailer so it treats ActionView the same way that ActionController does. Closes #10244 [Rick Olson]
-
- * Pass the template_root as an array as ActionView's view_path
- * Request templates with the "#{mailer_name}/#{action}" as opposed to just "#{action}"
-
-* Fixed that partials would be broken when using text.plain.erb as the extension #10130 [java]
-
-* Update README to use new smtp settings configuration API. Closes #10060 [psq]
-
-* Allow ActionMailer subclasses to individually set their delivery method (so two subclasses can have different delivery methods) #10033 [Zach Dennis]
-
-* Update TMail to v1.1.0. Use an updated version of TMail if available. [Mikel Lindsaar]
-
-* Introduce a new base test class for testing Mailers. ActionMailer::TestCase [Michael Koziarski]
-
-* Fix silent failure of rxml templates. #9879 [jstewart]
-
-* Fix attachment decoding when using the TMail C extension. #7861 [orangechicken]
-
-* Increase mail delivery test coverage. #8692 [Kamal Fariz Mahyuddin]
-
-* Register alternative template engines using ActionMailer::Base.register_template_extension('haml'). #7534 [cwd, Josh Peek]
-
-* Only load ActionController::UrlWriter if ActionController is present [Rick Olson]
-
-* Make sure parsed emails recognized attachments nested inside multipart parts. #6714 [Jamis Buck]
-
-* Allow mailer actions named send by using __send__ internally. #6467 [iGEL]
-
-* Add assert_emails and assert_no_emails to test the number of emails delivered. #6479 [Jonathan Viney]
- # Assert total number of emails delivered:
- assert_emails 0
- ContactMailer.deliver_contact
- assert_emails 1
-
- # Assert number of emails delivered within a block:
- assert_emails 1 do
- post :signup, :name => 'Jonathan'
- end
-
-
-*1.3.3* (March 12th, 2007)
-
-* Depend on Action Pack 1.13.3
-
-
-*1.3.2* (February 5th, 2007)
-
-* Deprecate server_settings renaming it to smtp_settings, add sendmail_settings to allow you to override the arguments to and location of the sendmail executable. [Michael Koziarski]
-
-
-*1.3.1* (January 16th, 2007)
-
-* Depend on Action Pack 1.13.1
-
-
-*1.3.0* (January 16th, 2007)
-
-* Make mime version default to 1.0. closes #2323 [ror@andreas-s.net]
-
-* Make sure quoted-printable text is decoded correctly when only portions of the text are encoded. closes #3154. [jon@siliconcircus.com]
-
-* Make sure DOS newlines in quoted-printable text are normalized to unix newlines before unquoting. closes #4166 and #4452. [Jamis Buck]
-
-* Fixed that iconv decoding should catch InvalidEncoding #3153 [jon@siliconcircus.com]
-
-* Tighten rescue clauses. #5985 [james@grayproductions.net]
-
-* Automatically included ActionController::UrlWriter, such that URL generation can happen within ActionMailer controllers. [David Heinemeier Hansson]
-
-* Replace Reloadable with Reloadable::Deprecated. [Nicholas Seckar]
-
-* Mailer template root applies to a class and its subclasses rather than acting globally. #5555 [somekool@gmail.com]
-
-* Resolve action naming collision. #5520 [ssinghi@kreeti.com]
-
-* ActionMailer::Base documentation rewrite. Closes #4991 [Kevin Clark, Marcel Molina Jr.]
-
-* Replace alias method chaining with Module#alias_method_chain. [Marcel Molina Jr.]
-
-* Replace Ruby's deprecated append_features in favor of included. [Marcel Molina Jr.]
-
-* Correct spurious documentation example code which results in a SyntaxError. [Marcel Molina Jr.]
-
-
-*1.2.1* (April 6th, 2006)
-
-* Be part of Rails 1.1.1
-
-
-*1.2.0* (March 27th, 2006)
-
-* Nil charset caused subject line to be improperly quoted in implicitly multipart messages #2662 [ehalvorsen+rails@runbox.com]
-
-* Parse content-type apart before using it so that sub-parts of the header can be set correctly #2918 [Jamis Buck]
-
-* Make custom headers work in subparts #4034 [elan@bluemandrill.com]
-
-* Template paths with dot chars in them no longer mess up implicit template selection for multipart messages #3332 [Chad Fowler]
-
-* Make sure anything with content-disposition of "attachment" is passed to the attachment presenter when parsing an email body [Jamis Buck]
-
-* Make sure TMail#attachments includes anything with content-disposition of "attachment", regardless of content-type [Jamis Buck]
-
-
-*1.1.5* (December 13th, 2005)
-
-* Become part of Rails 1.0
-
-
-*1.1.4* (December 7th, 2005)
-
-* Rename Version constant to VERSION. #2802 [Marcel Molina Jr.]
-
-* Stricter matching for implicitly multipart filenames excludes files ending in unsupported extensions (such as foo.rhtml.bak) and without a two-part content type (such as foo.text.rhtml or foo.text.really.plain.rhtml). #2398 [Dave Burt , Jeremy Kemper]
-
-
-*1.1.3* (November 7th, 2005)
-
-* Allow Mailers to have custom initialize methods that set default instance variables for all mail actions #2563 [mrj@bigpond.net.au]
-
-
-*1.1.2* (October 26th, 2005)
-
-* Upgraded to Action Pack 1.10.2
-
-
-*1.1.1* (October 19th, 2005)
-
-* Upgraded to Action Pack 1.10.1
-
-
-*1.1.0* (October 16th, 2005)
-
-* Update and extend documentation (rdoc)
-
-* Minero Aoki made TMail available to Rails/ActionMailer under the MIT license (instead of LGPL) [RubyConf '05]
-
-* Austin Ziegler made Text::Simple available to Rails/ActionMailer under a MIT-like licens [See rails ML, subject "Text::Format Licence Exception" on Oct 15, 2005]
-
-* Fix vendor require paths to prevent files being required twice
-
-* Don't add charset to content-type header for a part that contains subparts (for AOL compatibility) #2013 [John Long]
-
-* Preserve underscores when unquoting message bodies #1930
-
-* Encode multibyte characters correctly #1894
-
-* Multipart messages specify a MIME-Version header automatically #2003 [John Long]
-
-* Add a unified render method to ActionMailer (delegates to ActionView::Base#render)
-
-* Move mailer initialization to a separate (overridable) method, so that subclasses may alter the various defaults #1727
-
-* Look at content-location header (if available) to determine filename of attachments #1670
-
-* ActionMailer::Base.deliver(email) had been accidentally removed, but was documented in the Rails book #1849
-
-* Fix problem with sendmail delivery where headers should be delimited by \n characters instead of \r\n, which confuses some mail readers #1742 [Kent Sibilev]
-
-
-*1.0.1* (11 July, 2005)
-
-* Bind to Action Pack 1.9.1
-
-
-*1.0.0* (6 July, 2005)
-
-* Avoid adding nil header values #1392
-
-* Better multipart support with implicit multipart/alternative and sorting of subparts [John Long]
-
-* Allow for nested parts in multipart mails #1570 [Flurin Egger]
-
-* Normalize line endings in outgoing mail bodies to "\n" #1536 [John Long]
-
-* Allow template to be explicitly specified #1448 [tuxie@dekadance.se]
-
-* Allow specific "multipart/xxx" content-type to be set on multipart messages #1412 [Flurin Egger]
-
-* Unquoted @ characters in headers are now accepted in spite of RFC 822 #1206
-
-* Helper support (borrowed from ActionPack)
-
-* Silently ignore Errno::EINVAL errors when converting text.
-
-* Don't cause an error when parsing an encoded attachment name #1340 [lon@speedymac.com]
-
-* Nested multipart message parts are correctly processed in TMail::Mail#body
-
-* BCC headers are removed when sending via SMTP #1402
-
-* Added 'content_type' accessor, to allow content type to be set on a per-message basis. content_type defaults to "text/plain".
-
-* Silently ignore Iconv::IllegalSequence errors when converting text #1341 [lon@speedymac.com]
-
-* Support attachments and multipart messages.
-
-* Added new accessors for the various mail properties.
-
-* Fix to only perform the charset conversion if a 'from' and a 'to' charset are given (make no assumptions about what the charset was) #1276 [Jamis Buck]
-
-* Fix attachments and content-type problems #1276 [Jamis Buck]
-
-* Fixed the TMail#body method to look at the content-transfer-encoding header and unquote the body according to the rules it specifies #1265 [Jamis Buck]
-
-* Added unquoting even if the iconv lib can't be loaded--in that case, only the charset conversion is skipped #1265 [Jamis Buck]
-
-* Added automatic decoding of base64 bodies #1214 [Jamis Buck]
-
-* Added that delivery errors are caught in a way so the mail is still returned whether the delivery was successful or not
-
-* Fixed that email address like "Jamis Buck, M.D." would cause the quoter to generate emails resulting in "bad address" errors from the mail server #1220 [Jamis Buck]
-
-
-*0.9.1* (20th April, 2005)
-
-* Depend on Action Pack 1.8.1
-
-
-*0.9.0* (19th April, 2005)
-
-* Added that deliver_* will now return the email that was sent
-
-* Added that quoting to UTF-8 only happens if the characters used are in that range #955 [Jamis Buck]
-
-* Fixed quoting for all address headers, not just to #955 [Jamis Buck]
-
-* Fixed unquoting of emails that doesn't have an explicit charset #1036 [wolfgang@stufenlos.net]
-
-
-*0.8.1* (27th March, 2005)
-
-* Fixed that if charset was found that the end of a mime part declaration TMail would throw an error #919 [lon@speedymac.com]
-
-* Fixed that TMail::Unquoter would fail to recognize quoting method if it was in lowercase #919 [lon@speedymac.com]
-
-* Fixed that TMail::Encoder would fail when it attempts to parse e-mail addresses which are encoded using something other than the messages encoding method #919 [lon@speedymac.com]
-
-* Added rescue for missing iconv library and throws warnings if subject/body is called on a TMail object without it instead
-
-
-*0.8.0* (22th March, 2005)
-
-* Added framework support for processing incoming emails with an Action Mailer class. See example in README.
-
-
-*0.7.1* (7th March, 2005)
-
-* Bind to newest Action Pack (1.5.1)
-
-
-*0.7.0* (24th February, 2005)
-
-* Added support for charsets for both subject and body. The default charset is now UTF-8 #673 [Jamis Buck]. Examples:
-
- def iso_charset(recipient)
- @recipients = recipient
- @subject = "testing iso charsets"
- @from = "system@loudthinking.com"
- @body = "Nothing to see here."
- @charset = "iso-8859-1"
- end
-
- def unencoded_subject(recipient)
- @recipients = recipient
- @subject = "testing unencoded subject"
- @from = "system@loudthinking.com"
- @body = "Nothing to see here."
- @encode_subject = false
- @charset = "iso-8859-1"
- end
-
-
-*0.6.1* (January 18th, 2005)
-
-* Fixed sending of emails to use Tmail#from not the deprecated Tmail#from_address
-
-
-*0.6* (January 17th, 2005)
-
-* Fixed that bcc and cc should be settable through @bcc and @cc -- not just @headers["Bcc"] and @headers["Cc"] #453 [Eric Hodel]
-
-* Fixed Action Mailer to be "warnings safe" so you can run with ruby -w and not get framework warnings #453 [Eric Hodel]
-
-
-*0.5*
-
-* Added access to custom headers, like cc, bcc, and reply-to #268 [Andreas Schwarz]. Example:
-
- def post_notification(recipients, post)
- @recipients = recipients
- @from = post.author.email_address_with_name
- @headers["bcc"] = SYSTEM_ADMINISTRATOR_EMAIL
- @headers["reply-to"] = "notifications@example.com"
- @subject = "[#{post.account.name} #{post.title}]"
- @body["post"] = post
- end
-
-*0.4* (5)
-
-* Consolidated the server configuration options into Base#server_settings= and expanded that with controls for authentication and more [Marten]
- NOTE: This is an API change that could potentially break your application if you used the old application form. Please do change!
-
-* Added Base#deliveries as an accessor for an array of emails sent out through that ActionMailer class when using the :test delivery option. [Jeremy Kemper]
-
-* Added Base#perform_deliveries= which can be set to false to turn off the actual delivery of the email through smtp or sendmail.
- This is especially useful for functional testing that shouldn't send off real emails, but still trigger delivery_* methods.
-
-* Added option to specify delivery method with Base#delivery_method=. Default is :smtp and :sendmail is currently the only other option.
- Sendmail is assumed to be present at "/usr/sbin/sendmail" if that option is used. [Kent Sibilev]
-
-* Dropped "include TMail" as it added to much baggage into the default namespace (like Version) [Chad Fowler]
-
-
-*0.3*
-
-* First release
diff --git a/vendor/rails/actionmailer/MIT-LICENSE b/vendor/rails/actionmailer/MIT-LICENSE
deleted file mode 100644
index a345a241..00000000
--- a/vendor/rails/actionmailer/MIT-LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-Copyright (c) 2004-2010 David Heinemeier Hansson
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
diff --git a/vendor/rails/actionmailer/README b/vendor/rails/actionmailer/README
deleted file mode 100644
index 0e16ea6e..00000000
--- a/vendor/rails/actionmailer/README
+++ /dev/null
@@ -1,149 +0,0 @@
-= Action Mailer -- Easy email delivery and testing
-
-Action Mailer is a framework for designing email-service layers. These layers
-are used to consolidate code for sending out forgotten passwords, welcome
-wishes on signup, invoices for billing, and any other use case that requires
-a written notification to either a person or another system.
-
-Additionally, an Action Mailer class can be used to process incoming email,
-such as allowing a weblog to accept new posts from an email (which could even
-have been sent from a phone).
-
-== Sending emails
-
-The framework works by setting up all the email details, except the body,
-in methods on the service layer. Subject, recipients, sender, and timestamp
-are all set up this way. An example of such a method:
-
- def signed_up(recipient)
- recipients recipient
- subject "[Signed up] Welcome #{recipient}"
- from "system@loudthinking.com"
- body :recipient => recipient
- end
-
-The body of the email is created by using an Action View template (regular
-ERb) that has the content of the body hash parameter available as instance variables.
-So the corresponding body template for the method above could look like this:
-
- Hello there,
-
- Mr. <%= @recipient %>
-
-And if the recipient was given as "david@loudthinking.com", the email
-generated would look like this:
-
- Date: Sun, 12 Dec 2004 00:00:00 +0100
- From: system@loudthinking.com
- To: david@loudthinking.com
- Subject: [Signed up] Welcome david@loudthinking.com
-
- Hello there,
-
- Mr. david@loudthinking.com
-
-You never actually call the instance methods like signed_up directly. Instead,
-you call class methods like deliver_* and create_* that are automatically
-created for each instance method. So if the signed_up method sat on
-ApplicationMailer, it would look like this:
-
- ApplicationMailer.create_signed_up("david@loudthinking.com") # => tmail object for testing
- ApplicationMailer.deliver_signed_up("david@loudthinking.com") # sends the email
- ApplicationMailer.new.signed_up("david@loudthinking.com") # won't work!
-
-== Receiving emails
-
-To receive emails, you need to implement a public instance method called receive that takes a
-tmail object as its single parameter. The Action Mailer framework has a corresponding class method,
-which is also called receive, that accepts a raw, unprocessed email as a string, which it then turns
-into the tmail object and calls the receive instance method.
-
-Example:
-
- class Mailman < ActionMailer::Base
- def receive(email)
- page = Page.find_by_address(email.to.first)
- page.emails.create(
- :subject => email.subject, :body => email.body
- )
-
- if email.has_attachments?
- for attachment in email.attachments
- page.attachments.create({
- :file => attachment, :description => email.subject
- })
- end
- end
- end
- end
-
-This Mailman can be the target for Postfix or other MTAs. In Rails, you would use the runner in the
-trivial case like this:
-
- ./script/runner 'Mailman.receive(STDIN.read)'
-
-However, invoking Rails in the runner for each mail to be received is very resource intensive. A single
-instance of Rails should be run within a daemon if it is going to be utilized to process more than just
-a limited number of email.
-
-== Configuration
-
-The Base class has the full list of configuration options. Here's an example:
-
- ActionMailer::Base.smtp_settings = {
- :address => 'smtp.yourserver.com', # default: localhost
- :port => '25', # default: 25
- :user_name => 'user',
- :password => 'pass',
- :authentication => :plain # :plain, :login or :cram_md5
- }
-
-== Dependencies
-
-Action Mailer requires that the Action Pack is either available to be required immediately
-or is accessible as a GEM.
-
-
-== Bundled software
-
-* tmail 0.10.8 by Minero Aoki released under LGPL
- Read more on http://i.loveruby.net/en/prog/tmail.html
-
-* Text::Format 0.63 by Austin Ziegler released under OpenSource
- Read more on http://www.halostatue.ca/ruby/Text__Format.html
-
-
-== Download
-
-The latest version of Action Mailer can be found at
-
-* http://rubyforge.org/project/showfiles.php?group_id=361
-
-Documentation can be found at
-
-* http://actionmailer.rubyonrails.org
-
-
-== Installation
-
-You can install Action Mailer with the following command.
-
- % [sudo] ruby install.rb
-
-from its distribution directory.
-
-
-== License
-
-Action Mailer is released under the MIT license.
-
-
-== Support
-
-The Action Mailer homepage is http://www.rubyonrails.org. You can find
-the Action Mailer RubyForge page at http://rubyforge.org/projects/actionmailer.
-And as Jim from Rake says:
-
- Feel free to submit commits or feature requests. If you send a patch,
- remember to update the corresponding unit tests. If fact, I prefer
- new feature to be submitted in the form of new unit tests.
diff --git a/vendor/rails/actionmailer/Rakefile b/vendor/rails/actionmailer/Rakefile
deleted file mode 100644
index e7ef2b23..00000000
--- a/vendor/rails/actionmailer/Rakefile
+++ /dev/null
@@ -1,99 +0,0 @@
-require 'rubygems'
-require 'rake'
-require 'rake/testtask'
-require 'rake/rdoctask'
-require 'rake/packagetask'
-require 'rake/gempackagetask'
-require File.join(File.dirname(__FILE__), 'lib', 'action_mailer', 'version')
-
-PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
-PKG_NAME = 'actionmailer'
-PKG_VERSION = ActionMailer::VERSION::STRING + PKG_BUILD
-PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
-
-RELEASE_NAME = "REL #{PKG_VERSION}"
-
-RUBY_FORGE_PROJECT = "actionmailer"
-RUBY_FORGE_USER = "webster132"
-
-desc "Default Task"
-task :default => [ :test ]
-
-# Run the unit tests
-Rake::TestTask.new { |t|
- t.libs << "test"
- t.pattern = 'test/*_test.rb'
- t.verbose = true
- t.warning = false
-}
-
-
-# Generate the RDoc documentation
-Rake::RDocTask.new { |rdoc|
- rdoc.rdoc_dir = 'doc'
- rdoc.title = "Action Mailer -- Easy email delivery and testing"
- rdoc.options << '--line-numbers' << '--inline-source' << '-A cattr_accessor=object'
- rdoc.options << '--charset' << 'utf-8'
- rdoc.template = ENV['template'] ? "#{ENV['template']}.rb" : '../doc/template/horo'
- rdoc.rdoc_files.include('README', 'CHANGELOG')
- rdoc.rdoc_files.include('lib/action_mailer.rb')
- rdoc.rdoc_files.include('lib/action_mailer/*.rb')
-}
-
-
-# Create compressed packages
-spec = Gem::Specification.new do |s|
- s.platform = Gem::Platform::RUBY
- s.name = PKG_NAME
- s.summary = "Service layer for easy email delivery and testing."
- s.description = %q{Makes it trivial to test and deliver emails sent from a single service layer.}
- s.version = PKG_VERSION
-
- s.author = "David Heinemeier Hansson"
- s.email = "david@loudthinking.com"
- s.rubyforge_project = "actionmailer"
- s.homepage = "http://www.rubyonrails.org"
-
- s.add_dependency('actionpack', '= 2.3.11' + PKG_BUILD)
-
- s.has_rdoc = true
- s.requirements << 'none'
- s.require_path = 'lib'
- s.autorequire = 'action_mailer'
-
- s.files = [ "Rakefile", "install.rb", "README", "CHANGELOG", "MIT-LICENSE" ]
- s.files = s.files + Dir.glob( "lib/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
- s.files = s.files + Dir.glob( "test/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
-end
-
-Rake::GemPackageTask.new(spec) do |p|
- p.gem_spec = spec
- p.need_tar = true
- p.need_zip = true
-end
-
-
-desc "Publish the API documentation"
-task :pgem => [:package] do
- require 'rake/contrib/sshpublisher'
- Rake::SshFilePublisher.new("gems.rubyonrails.org", "/u/sites/gems/gems", "pkg", "#{PKG_FILE_NAME}.gem").upload
- `ssh gems.rubyonrails.org '/u/sites/gems/gemupdate.sh'`
-end
-
-desc "Publish the API documentation"
-task :pdoc => [:rdoc] do
- require 'rake/contrib/sshpublisher'
- Rake::SshDirPublisher.new("wrath.rubyonrails.org", "public_html/am", "doc").upload
-end
-
-desc "Publish the release files to RubyForge."
-task :release => [ :package ] do
- require 'rubyforge'
- require 'rake/contrib/rubyforgepublisher'
-
- packages = %w( gem tgz zip ).collect{ |ext| "pkg/#{PKG_NAME}-#{PKG_VERSION}.#{ext}" }
-
- rubyforge = RubyForge.new
- rubyforge.login
- rubyforge.add_release(PKG_NAME, PKG_NAME, "REL #{PKG_VERSION}", *packages)
-end
diff --git a/vendor/rails/actionmailer/install.rb b/vendor/rails/actionmailer/install.rb
deleted file mode 100644
index 8d7c140c..00000000
--- a/vendor/rails/actionmailer/install.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-require 'rbconfig'
-require 'find'
-require 'ftools'
-
-include Config
-
-# this was adapted from rdoc's install.rb by way of Log4r
-
-$sitedir = CONFIG["sitelibdir"]
-unless $sitedir
- version = CONFIG["MAJOR"] + "." + CONFIG["MINOR"]
- $libdir = File.join(CONFIG["libdir"], "ruby", version)
- $sitedir = $:.find {|x| x =~ /site_ruby/ }
- if !$sitedir
- $sitedir = File.join($libdir, "site_ruby")
- elsif $sitedir !~ Regexp.quote(version)
- $sitedir = File.join($sitedir, version)
- end
-end
-
-# the actual gruntwork
-Dir.chdir("lib")
-
-Find.find("action_mailer", "action_mailer.rb") { |f|
- if f[-3..-1] == ".rb"
- File::install(f, File.join($sitedir, *f.split(/\//)), 0644, true)
- else
- File::makedirs(File.join($sitedir, *f.split(/\//)))
- end
-}
diff --git a/vendor/rails/actionmailer/lib/action_mailer.rb b/vendor/rails/actionmailer/lib/action_mailer.rb
deleted file mode 100644
index e0440b8a..00000000
--- a/vendor/rails/actionmailer/lib/action_mailer.rb
+++ /dev/null
@@ -1,62 +0,0 @@
-#--
-# Copyright (c) 2004-2010 David Heinemeier Hansson
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#++
-
-begin
- require 'action_controller'
-rescue LoadError
- actionpack_path = "#{File.dirname(__FILE__)}/../../actionpack/lib"
- if File.directory?(actionpack_path)
- $:.unshift actionpack_path
- require 'action_controller'
- end
-end
-
-require 'action_view'
-
-module ActionMailer
- def self.load_all!
- [Base, Part, ::Text::Format, ::Net::SMTP]
- end
-
- autoload :AdvAttrAccessor, 'action_mailer/adv_attr_accessor'
- autoload :Base, 'action_mailer/base'
- autoload :Helpers, 'action_mailer/helpers'
- autoload :Part, 'action_mailer/part'
- autoload :PartContainer, 'action_mailer/part_container'
- autoload :Quoting, 'action_mailer/quoting'
- autoload :TestCase, 'action_mailer/test_case'
- autoload :TestHelper, 'action_mailer/test_helper'
- autoload :Utils, 'action_mailer/utils'
-end
-
-module Text
- autoload :Format, 'action_mailer/vendor/text_format'
-end
-
-module Net
- autoload :SMTP, 'net/smtp'
-end
-
-autoload :MailHelper, 'action_mailer/mail_helper'
-
-require 'action_mailer/vendor/tmail'
diff --git a/vendor/rails/actionmailer/lib/action_mailer/adv_attr_accessor.rb b/vendor/rails/actionmailer/lib/action_mailer/adv_attr_accessor.rb
deleted file mode 100644
index e77029af..00000000
--- a/vendor/rails/actionmailer/lib/action_mailer/adv_attr_accessor.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-module ActionMailer
- module AdvAttrAccessor #:nodoc:
- def self.included(base)
- base.extend(ClassMethods)
- end
-
- module ClassMethods #:nodoc:
- def adv_attr_accessor(*names)
- names.each do |name|
- ivar = "@#{name}"
-
- define_method("#{name}=") do |value|
- instance_variable_set(ivar, value)
- end
-
- define_method(name) do |*parameters|
- raise ArgumentError, "expected 0 or 1 parameters" unless parameters.length <= 1
- if parameters.empty?
- if instance_variable_names.include?(ivar)
- instance_variable_get(ivar)
- end
- else
- instance_variable_set(ivar, parameters.first)
- end
- end
- end
- end
- end
- end
-end
diff --git a/vendor/rails/actionmailer/lib/action_mailer/base.rb b/vendor/rails/actionmailer/lib/action_mailer/base.rb
deleted file mode 100644
index 3e4e7d1f..00000000
--- a/vendor/rails/actionmailer/lib/action_mailer/base.rb
+++ /dev/null
@@ -1,739 +0,0 @@
-module ActionMailer #:nodoc:
- # Action Mailer allows you to send email from your application using a mailer model and views.
- #
- #
- # = Mailer Models
- #
- # To use Action Mailer, you need to create a mailer model.
- #
- # $ script/generate mailer Notifier
- #
- # The generated model inherits from ActionMailer::Base. Emails are defined by creating methods within the model which are then
- # used to set variables to be used in the mail template, to change options on the mail, or
- # to add attachments.
- #
- # Examples:
- #
- # class Notifier < ActionMailer::Base
- # def signup_notification(recipient)
- # recipients recipient.email_address_with_name
- # bcc ["bcc@example.com", "Order Watcher "]
- # from "system@example.com"
- # subject "New account information"
- # body :account => recipient
- # end
- # end
- #
- # Mailer methods have the following configuration methods available.
- #
- # * recipients - Takes one or more email addresses. These addresses are where your email will be delivered to. Sets the To: header.
- # * subject - The subject of your email. Sets the Subject: header.
- # * from - Who the email you are sending is from. Sets the From: header.
- # * cc - Takes one or more email addresses. These addresses will receive a carbon copy of your email. Sets the Cc: header.
- # * bcc - Takes one or more email addresses. These addresses will receive a blind carbon copy of your email. Sets the Bcc: header.
- # * reply_to - Takes one or more email addresses. These addresses will be listed as the default recipients when replying to your email. Sets the Reply-To: header.
- # * sent_on - The date on which the message was sent. If not set, the header wil be set by the delivery agent.
- # * content_type - Specify the content type of the message. Defaults to text/plain.
- # * headers - Specify additional headers to be set for the message, e.g. headers 'X-Mail-Count' => 107370.
- #
- # When a headers 'return-path' is specified, that value will be used as the 'envelope from'
- # address. Setting this is useful when you want delivery notifications sent to a different address than
- # the one in from.
- #
- # The body method has special behavior. It takes a hash which generates an instance variable
- # named after each key in the hash containing the value that that key points to.
- #
- # So, for example, body :account => recipient would result
- # in an instance variable @account with the value of recipient being accessible in the
- # view.
- #
- #
- # = Mailer views
- #
- # Like Action Controller, each mailer class has a corresponding view directory
- # in which each method of the class looks for a template with its name.
- # To define a template to be used with a mailing, create an .erb file with the same name as the method
- # in your mailer model. For example, in the mailer defined above, the template at
- # app/views/notifier/signup_notification.erb would be used to generate the email.
- #
- # Variables defined in the model are accessible as instance variables in the view.
- #
- # Emails by default are sent in plain text, so a sample view for our model example might look like this:
- #
- # Hi <%= @account.name %>,
- # Thanks for joining our service! Please check back often.
- #
- # You can even use Action Pack helpers in these views. For example:
- #
- # You got a new note!
- # <%= truncate(note.body, 25) %>
- #
- #
- # = Generating URLs
- #
- # URLs can be generated in mailer views using url_for or named routes.
- # Unlike controllers from Action Pack, the mailer instance doesn't have any context about the incoming request,
- # so you'll need to provide all of the details needed to generate a URL.
- #
- # When using url_for you'll need to provide the :host, :controller, and :action:
- #
- # <%= url_for(:host => "example.com", :controller => "welcome", :action => "greeting") %>
- #
- # When using named routes you only need to supply the :host:
- #
- # <%= users_url(:host => "example.com") %>
- #
- # You will want to avoid using the name_of_route_path form of named routes because it doesn't make sense to
- # generate relative URLs in email messages.
- #
- # It is also possible to set a default host that will be used in all mailers by setting the :host option in
- # the ActionMailer::Base.default_url_options hash as follows:
- #
- # ActionMailer::Base.default_url_options[:host] = "example.com"
- #
- # This can also be set as a configuration option in config/environment.rb:
- #
- # config.action_mailer.default_url_options = { :host => "example.com" }
- #
- # If you do decide to set a default :host for your mailers you will want to use the
- # :only_path => false option when using url_for. This will ensure that absolute URLs are generated because
- # the url_for view helper will, by default, generate relative URLs when a :host option isn't
- # explicitly provided.
- #
- # = Sending mail
- #
- # Once a mailer action and template are defined, you can deliver your message or create it and save it
- # for delivery later:
- #
- # Notifier.deliver_signup_notification(david) # sends the email
- # mail = Notifier.create_signup_notification(david) # => a tmail object
- # Notifier.deliver(mail)
- #
- # You never instantiate your mailer class. Rather, your delivery instance
- # methods are automatically wrapped in class methods that start with the word
- # deliver_ followed by the name of the mailer method that you would
- # like to deliver. The signup_notification method defined above is
- # delivered by invoking Notifier.deliver_signup_notification.
- #
- #
- # = HTML email
- #
- # To send mail as HTML, make sure your view (the .erb file) generates HTML and
- # set the content type to html.
- #
- # class MyMailer < ActionMailer::Base
- # def signup_notification(recipient)
- # recipients recipient.email_address_with_name
- # subject "New account information"
- # from "system@example.com"
- # body :account => recipient
- # content_type "text/html"
- # end
- # end
- #
- #
- # = Multipart email
- #
- # You can explicitly specify multipart messages:
- #
- # class ApplicationMailer < ActionMailer::Base
- # def signup_notification(recipient)
- # recipients recipient.email_address_with_name
- # subject "New account information"
- # from "system@example.com"
- # content_type "multipart/alternative"
- #
- # part :content_type => "text/html",
- # :body => render_message("signup-as-html", :account => recipient)
- #
- # part "text/plain" do |p|
- # p.body = render_message("signup-as-plain", :account => recipient)
- # p.transfer_encoding = "base64"
- # end
- # end
- # end
- #
- # Multipart messages can also be used implicitly because Action Mailer will automatically
- # detect and use multipart templates, where each template is named after the name of the action, followed
- # by the content type. Each such detected template will be added as separate part to the message.
- #
- # For example, if the following templates existed:
- # * signup_notification.text.plain.erb
- # * signup_notification.text.html.erb
- # * signup_notification.text.xml.builder
- # * signup_notification.text.x-yaml.erb
- #
- # Each would be rendered and added as a separate part to the message,
- # with the corresponding content type. The content type for the entire
- # message is automatically set to multipart/alternative, which indicates
- # that the email contains multiple different representations of the same email
- # body. The same body hash is passed to each template.
- #
- # Implicit template rendering is not performed if any attachments or parts have been added to the email.
- # This means that you'll have to manually add each part to the email and set the content type of the email
- # to multipart/alternative.
- #
- # = Attachments
- #
- # Attachments can be added by using the +attachment+ method.
- #
- # Example:
- #
- # class ApplicationMailer < ActionMailer::Base
- # # attachments
- # def signup_notification(recipient)
- # recipients recipient.email_address_with_name
- # subject "New account information"
- # from "system@example.com"
- #
- # attachment :content_type => "image/jpeg",
- # :body => File.read("an-image.jpg")
- #
- # attachment "application/pdf" do |a|
- # a.body = generate_your_pdf_here()
- # end
- # end
- # end
- #
- # = Multipart Emails with Attachments
- #
- # Multipart emails that also have attachments can be created by nesting a "multipart/alternative" part
- # within an email that has its content type set to "multipart/mixed". This would also need two templates
- # in place within +app/views/mailer+ called "welcome_email.text.html.erb" and "welcome_email.text.plain.erb"
- #
- # class ApplicationMailer < ActionMailer::Base
- # def signup_notification(recipient)
- # recipients recipient.email_address_with_name
- # subject "New account information"
- # from "system@example.com"
- # content_type "multipart/mixed"
- #
- # part "multipart/alternative" do |alternative|
- #
- # alternative.part "text/html" do |html|
- # html.body = render_message("welcome_email.text.html", :message => "HTML content
")
- # end
- #
- # alternative.part "text/plain" do |plain|
- # plain.body = render_message("welcome_email.text.plain", :message => "text content")
- # end
- #
- # end
- #
- # attachment :content_type => "image/png",
- # :body => File.read(File.join(RAILS_ROOT, 'public/images/rails.png'))
- #
- # attachment "application/pdf" do |a|
- # a.body = File.read('/Users/mikel/Code/mail/spec/fixtures/attachments/test.pdf')
- # end
- # end
- # end
- #
- # = Configuration options
- #
- # These options are specified on the class level, like ActionMailer::Base.template_root = "/my/templates"
- #
- # * template_root - Determines the base from which template references will be made.
- #
- # * logger - the logger is used for generating information on the mailing run if available.
- # Can be set to nil for no logging. Compatible with both Ruby's own Logger and Log4r loggers.
- #
- # * smtp_settings - Allows detailed configuration for :smtp delivery method:
- # * :address - Allows you to use a remote mail server. Just change it from its default "localhost" setting.
- # * :port - On the off chance that your mail server doesn't run on port 25, you can change it.
- # * :domain - If you need to specify a HELO domain, you can do it here.
- # * :user_name - If your mail server requires authentication, set the username in this setting.
- # * :password - If your mail server requires authentication, set the password in this setting.
- # * :authentication - If your mail server requires authentication, you need to specify the authentication type here.
- # This is a symbol and one of :plain, :login, :cram_md5.
- # * :enable_starttls_auto - When set to true, detects if STARTTLS is enabled in your SMTP server and starts to use it.
- # It works only on Ruby >= 1.8.7 and Ruby >= 1.9. Default is true.
- #
- # * sendmail_settings - Allows you to override options for the :sendmail delivery method.
- # * :location - The location of the sendmail executable. Defaults to /usr/sbin/sendmail.
- # * :arguments - The command line arguments. Defaults to -i -t.
- #
- # * raise_delivery_errors - Whether or not errors should be raised if the email fails to be delivered.
- #
- # * delivery_method - Defines a delivery method. Possible values are :smtp (default), :sendmail, and :test.
- #
- # * perform_deliveries - Determines whether deliver_* methods are actually carried out. By default they are,
- # but this can be turned off to help functional testing.
- #
- # * deliveries - Keeps an array of all the emails sent out through the Action Mailer with delivery_method :test. Most useful
- # for unit and functional testing.
- #
- # * default_charset - The default charset used for the body and to encode the subject. Defaults to UTF-8. You can also
- # pick a different charset from inside a method with +charset+.
- #
- # * default_content_type - The default content type used for the main part of the message. Defaults to "text/plain". You
- # can also pick a different content type from inside a method with +content_type+.
- #
- # * default_mime_version - The default mime version used for the message. Defaults to 1.0. You
- # can also pick a different value from inside a method with +mime_version+.
- #
- # * default_implicit_parts_order - When a message is built implicitly (i.e. multiple parts are assembled from templates
- # which specify the content type in their filenames) this variable controls how the parts are ordered. Defaults to
- # ["text/html", "text/enriched", "text/plain"]. Items that appear first in the array have higher priority in the mail client
- # and appear last in the mime encoded message. You can also pick a different order from inside a method with
- # +implicit_parts_order+.
- class Base
- include AdvAttrAccessor, PartContainer, Quoting, Utils
- if Object.const_defined?(:ActionController)
- include ActionController::UrlWriter
- include ActionController::Layout
- end
-
- private_class_method :new #:nodoc:
-
- class_inheritable_accessor :view_paths
- self.view_paths = []
-
- cattr_accessor :logger
-
- @@smtp_settings = {
- :address => "localhost",
- :port => 25,
- :domain => 'localhost.localdomain',
- :user_name => nil,
- :password => nil,
- :authentication => nil,
- :enable_starttls_auto => true,
- }
- cattr_accessor :smtp_settings
-
- @@sendmail_settings = {
- :location => '/usr/sbin/sendmail',
- :arguments => '-i -t'
- }
- cattr_accessor :sendmail_settings
-
- @@raise_delivery_errors = true
- cattr_accessor :raise_delivery_errors
-
- class_attribute :delivery_method
- self.delivery_method = :smtp
-
- @@perform_deliveries = true
- cattr_accessor :perform_deliveries
-
- @@deliveries = []
- cattr_accessor :deliveries
-
- @@default_charset = "utf-8"
- cattr_accessor :default_charset
-
- @@default_content_type = "text/plain"
- cattr_accessor :default_content_type
-
- @@default_mime_version = "1.0"
- cattr_accessor :default_mime_version
-
- @@default_implicit_parts_order = [ "text/html", "text/enriched", "text/plain" ]
- cattr_accessor :default_implicit_parts_order
-
- cattr_reader :protected_instance_variables
- @@protected_instance_variables = %w(@body)
-
- # Specify the BCC addresses for the message
- adv_attr_accessor :bcc
-
- # Define the body of the message. This is either a Hash (in which case it
- # specifies the variables to pass to the template when it is rendered),
- # or a string, in which case it specifies the actual text of the message.
- adv_attr_accessor :body
-
- # Specify the CC addresses for the message.
- adv_attr_accessor :cc
-
- # Specify the charset to use for the message. This defaults to the
- # +default_charset+ specified for ActionMailer::Base.
- adv_attr_accessor :charset
-
- # Specify the content type for the message. This defaults to text/plain
- # in most cases, but can be automatically set in some situations.
- adv_attr_accessor :content_type
-
- # Specify the from address for the message.
- adv_attr_accessor :from
-
- # Specify the address (if different than the "from" address) to direct
- # replies to this message.
- adv_attr_accessor :reply_to
-
- # Specify additional headers to be added to the message.
- adv_attr_accessor :headers
-
- # Specify the order in which parts should be sorted, based on content-type.
- # This defaults to the value for the +default_implicit_parts_order+.
- adv_attr_accessor :implicit_parts_order
-
- # Defaults to "1.0", but may be explicitly given if needed.
- adv_attr_accessor :mime_version
-
- # The recipient addresses for the message, either as a string (for a single
- # address) or an array (for multiple addresses).
- adv_attr_accessor :recipients
-
- # The date on which the message was sent. If not set (the default), the
- # header will be set by the delivery agent.
- adv_attr_accessor :sent_on
-
- # Specify the subject of the message.
- adv_attr_accessor :subject
-
- # Specify the template name to use for current message. This is the "base"
- # template name, without the extension or directory, and may be used to
- # have multiple mailer methods share the same template.
- adv_attr_accessor :template
-
- # Override the mailer name, which defaults to an inflected version of the
- # mailer's class name. If you want to use a template in a non-standard
- # location, you can use this to specify that location.
- def mailer_name(value = nil)
- if value
- self.mailer_name = value
- else
- self.class.mailer_name
- end
- end
-
- def mailer_name=(value)
- self.class.mailer_name = value
- end
-
- # The mail object instance referenced by this mailer.
- attr_reader :mail
- attr_reader :template_name, :default_template_name, :action_name
-
- class << self
- attr_writer :mailer_name
-
- def mailer_name
- @mailer_name ||= name.underscore
- end
-
- # for ActionView compatibility
- alias_method :controller_name, :mailer_name
- alias_method :controller_path, :mailer_name
-
- def respond_to?(method_symbol, include_private = false) #:nodoc:
- matches_dynamic_method?(method_symbol) || super
- end
-
- def method_missing(method_symbol, *parameters) #:nodoc:
- if match = matches_dynamic_method?(method_symbol)
- case match[1]
- when 'create' then new(match[2], *parameters).mail
- when 'deliver' then new(match[2], *parameters).deliver!
- when 'new' then nil
- else super
- end
- else
- super
- end
- end
-
- # Receives a raw email, parses it into an email object, decodes it,
- # instantiates a new mailer, and passes the email object to the mailer
- # object's +receive+ method. If you want your mailer to be able to
- # process incoming messages, you'll need to implement a +receive+
- # method that accepts the email object as a parameter:
- #
- # class MyMailer < ActionMailer::Base
- # def receive(mail)
- # ...
- # end
- # end
- def receive(raw_email)
- logger.info "Received mail:\n #{raw_email}" unless logger.nil?
- mail = TMail::Mail.parse(raw_email)
- mail.base64_decode
- new.receive(mail)
- end
-
- # Deliver the given mail object directly. This can be used to deliver
- # a preconstructed mail object, like:
- #
- # email = MyMailer.create_some_mail(parameters)
- # email.set_some_obscure_header "frobnicate"
- # MyMailer.deliver(email)
- def deliver(mail)
- new.deliver!(mail)
- end
-
- def template_root
- self.view_paths && self.view_paths.first
- end
-
- def template_root=(root)
- self.view_paths = ActionView::Base.process_view_paths(root)
- end
-
- private
- def matches_dynamic_method?(method_name) #:nodoc:
- method_name = method_name.to_s
- /^(create|deliver)_([_a-z]\w*)/.match(method_name) || /^(new)$/.match(method_name)
- end
- end
-
- # Instantiate a new mailer object. If +method_name+ is not +nil+, the mailer
- # will be initialized according to the named method. If not, the mailer will
- # remain uninitialized (useful when you only need to invoke the "receive"
- # method, for instance).
- def initialize(method_name=nil, *parameters) #:nodoc:
- create!(method_name, *parameters) if method_name
- end
-
- # Initialize the mailer via the given +method_name+. The body will be
- # rendered and a new TMail::Mail object created.
- def create!(method_name, *parameters) #:nodoc:
- initialize_defaults(method_name)
- __send__(method_name, *parameters)
-
- # If an explicit, textual body has not been set, we check assumptions.
- unless String === @body
- # First, we look to see if there are any likely templates that match,
- # which include the content-type in their file name (i.e.,
- # "the_template_file.text.html.erb", etc.). Only do this if parts
- # have not already been specified manually.
- if @parts.empty?
- Dir.glob("#{template_path}/#{@template}.*").each do |path|
- template = template_root["#{mailer_name}/#{File.basename(path)}"]
-
- # Skip unless template has a multipart format
- next unless template && template.multipart?
-
- @parts << Part.new(
- :content_type => template.content_type,
- :disposition => "inline",
- :charset => charset,
- :body => render_message(template, @body)
- )
- end
- unless @parts.empty?
- @content_type = "multipart/alternative" if @content_type !~ /^multipart/
- @parts = sort_parts(@parts, @implicit_parts_order)
- end
- end
-
- # Then, if there were such templates, we check to see if we ought to
- # also render a "normal" template (without the content type). If a
- # normal template exists (or if there were no implicit parts) we render
- # it.
- template_exists = @parts.empty?
- template_exists ||= template_root["#{mailer_name}/#{@template}"]
- @body = render_message(@template, @body) if template_exists
-
- # Finally, if there are other message parts and a textual body exists,
- # we shift it onto the front of the parts and set the body to nil (so
- # that create_mail doesn't try to render it in addition to the parts).
- if !@parts.empty? && String === @body
- @parts.unshift Part.new(:charset => charset, :body => @body)
- @body = nil
- end
- end
-
- # If this is a multipart e-mail add the mime_version if it is not
- # already set.
- @mime_version ||= "1.0" if !@parts.empty?
-
- # build the mail object itself
- @mail = create_mail
- end
-
- # Delivers a TMail::Mail object. By default, it delivers the cached mail
- # object (from the create! method). If no cached mail object exists, and
- # no alternate has been given as the parameter, this will fail.
- def deliver!(mail = @mail)
- raise "no mail object available for delivery!" unless mail
- unless logger.nil?
- logger.info "Sent mail to #{Array(recipients).join(', ')}"
- logger.debug "\n#{mail.encoded}"
- end
-
- begin
- __send__("perform_delivery_#{delivery_method}", mail) if perform_deliveries
- rescue Exception => e # Net::SMTP errors or sendmail pipe errors
- raise e if raise_delivery_errors
- end
-
- return mail
- end
-
- private
- # Set up the default values for the various instance variables of this
- # mailer. Subclasses may override this method to provide different
- # defaults.
- def initialize_defaults(method_name)
- @charset ||= @@default_charset.dup
- @content_type ||= @@default_content_type.dup
- @implicit_parts_order ||= @@default_implicit_parts_order.dup
- @template ||= method_name
- @default_template_name = @action_name = @template
- @mailer_name ||= self.class.name.underscore
- @parts ||= []
- @headers ||= {}
- @body ||= {}
- @mime_version = @@default_mime_version.dup if @@default_mime_version
- @sent_on ||= Time.now
- end
-
- def render_message(method_name, body)
- if method_name.respond_to?(:content_type)
- @current_template_content_type = method_name.content_type
- end
- render :file => method_name, :body => body
- ensure
- @current_template_content_type = nil
- end
-
- def render(opts)
- body = opts.delete(:body)
- if opts[:file] && (opts[:file] !~ /\// && !opts[:file].respond_to?(:render))
- opts[:file] = "#{mailer_name}/#{opts[:file]}"
- end
-
- begin
- old_template, @template = @template, initialize_template_class(body)
- layout = respond_to?(:pick_layout, true) ? pick_layout(opts) : false
- @template.render(opts.merge(:layout => layout))
- ensure
- @template = old_template
- end
- end
-
- def default_template_format
- if @current_template_content_type
- Mime::Type.lookup(@current_template_content_type).to_sym
- else
- :html
- end
- end
-
- def candidate_for_layout?(options)
- !self.view_paths.find_template(default_template_name, default_template_format).exempt_from_layout?
- rescue ActionView::MissingTemplate
- return true
- end
-
- def template_root
- self.class.template_root
- end
-
- def template_root=(root)
- self.class.template_root = root
- end
-
- def template_path
- File.join(template_root, mailer_name)
- end
-
- def initialize_template_class(assigns)
- template = ActionView::Base.new(self.class.view_paths, assigns, self)
- template.template_format = default_template_format
- template
- end
-
- def sort_parts(parts, order = [])
- order = order.collect { |s| s.downcase }
-
- parts = parts.sort do |a, b|
- a_ct = a.content_type.downcase
- b_ct = b.content_type.downcase
-
- a_in = order.include? a_ct
- b_in = order.include? b_ct
-
- s = case
- when a_in && b_in
- order.index(a_ct) <=> order.index(b_ct)
- when a_in
- -1
- when b_in
- 1
- else
- a_ct <=> b_ct
- end
-
- # reverse the ordering because parts that come last are displayed
- # first in mail clients
- (s * -1)
- end
-
- parts
- end
-
- def create_mail
- m = TMail::Mail.new
-
- m.subject, = quote_any_if_necessary(charset, subject)
- m.to, m.from = quote_any_address_if_necessary(charset, recipients, from)
- m.bcc = quote_address_if_necessary(bcc, charset) unless bcc.nil?
- m.cc = quote_address_if_necessary(cc, charset) unless cc.nil?
- m.reply_to = quote_address_if_necessary(reply_to, charset) unless reply_to.nil?
- m.mime_version = mime_version unless mime_version.nil?
- m.date = sent_on.to_time rescue sent_on if sent_on
-
- headers.each { |k, v| m[k] = v }
-
- real_content_type, ctype_attrs = parse_content_type
-
- if @parts.empty?
- m.set_content_type(real_content_type, nil, ctype_attrs)
- m.body = normalize_new_lines(body)
- else
- if String === body
- part = TMail::Mail.new
- part.body = normalize_new_lines(body)
- part.set_content_type(real_content_type, nil, ctype_attrs)
- part.set_content_disposition "inline"
- m.parts << part
- end
-
- @parts.each do |p|
- part = (TMail::Mail === p ? p : p.to_mail(self))
- m.parts << part
- end
-
- if real_content_type =~ /multipart/
- ctype_attrs.delete "charset"
- m.set_content_type(real_content_type, nil, ctype_attrs)
- end
- end
-
- @mail = m
- end
-
- def perform_delivery_smtp(mail)
- destinations = mail.destinations
- mail.ready_to_send
- sender = (mail['return-path'] && mail['return-path'].spec) || Array(mail.from).first
-
- smtp = Net::SMTP.new(smtp_settings[:address], smtp_settings[:port])
- smtp.enable_starttls_auto if smtp_settings[:enable_starttls_auto] && smtp.respond_to?(:enable_starttls_auto)
- smtp.start(smtp_settings[:domain], smtp_settings[:user_name], smtp_settings[:password],
- smtp_settings[:authentication]) do |smtp|
- smtp.sendmail(mail.encoded, sender, destinations)
- end
- end
-
- def perform_delivery_sendmail(mail)
- sendmail_args = sendmail_settings[:arguments]
- sendmail_args += " -f \"#{mail['return-path']}\"" if mail['return-path']
- IO.popen("#{sendmail_settings[:location]} #{sendmail_args}","w+") do |sm|
- sm.print(mail.encoded.gsub(/\r/, ''))
- sm.flush
- end
- end
-
- def perform_delivery_test(mail)
- deliveries << mail
- end
- end
-
- Base.class_eval do
- include Helpers
- helper MailHelper
- end
-end
diff --git a/vendor/rails/actionmailer/lib/action_mailer/helpers.rb b/vendor/rails/actionmailer/lib/action_mailer/helpers.rb
deleted file mode 100644
index ab8611a8..00000000
--- a/vendor/rails/actionmailer/lib/action_mailer/helpers.rb
+++ /dev/null
@@ -1,113 +0,0 @@
-require 'active_support/dependencies'
-
-module ActionMailer
- module Helpers #:nodoc:
- def self.included(base) #:nodoc:
- # Initialize the base module to aggregate its helpers.
- base.class_inheritable_accessor :master_helper_module
- base.master_helper_module = Module.new
-
- # Extend base with class methods to declare helpers.
- base.extend(ClassMethods)
-
- base.class_eval do
- # Wrap inherited to create a new master helper module for subclasses.
- class << self
- alias_method_chain :inherited, :helper
- end
-
- # Wrap initialize_template_class to extend new template class
- # instances with the master helper module.
- alias_method_chain :initialize_template_class, :helper
- end
- end
-
- module ClassMethods
- # Makes all the (instance) methods in the helper module available to templates rendered through this controller.
- # See ActionView::Helpers (link:classes/ActionView/Helpers.html) for more about making your own helper modules
- # available to the templates.
- def add_template_helper(helper_module) #:nodoc:
- master_helper_module.module_eval "include #{helper_module}"
- end
-
- # Declare a helper:
- # helper :foo
- # requires 'foo_helper' and includes FooHelper in the template class.
- # helper FooHelper
- # includes FooHelper in the template class.
- # helper { def foo() "#{bar} is the very best" end }
- # evaluates the block in the template class, adding method +foo+.
- # helper(:three, BlindHelper) { def mice() 'mice' end }
- # does all three.
- def helper(*args, &block)
- args.flatten.each do |arg|
- case arg
- when Module
- add_template_helper(arg)
- when String, Symbol
- file_name = arg.to_s.underscore + '_helper'
- class_name = file_name.camelize
-
- begin
- require_dependency(file_name)
- rescue LoadError => load_error
- requiree = / -- (.*?)(\.rb)?$/.match(load_error.message).to_a[1]
- msg = (requiree == file_name) ? "Missing helper file helpers/#{file_name}.rb" : "Can't load file: #{requiree}"
- raise LoadError.new(msg).copy_blame!(load_error)
- end
-
- add_template_helper(class_name.constantize)
- else
- raise ArgumentError, 'helper expects String, Symbol, or Module argument'
- end
- end
-
- # Evaluate block in template class if given.
- master_helper_module.module_eval(&block) if block_given?
- end
-
- # Declare a controller method as a helper. For example,
- # helper_method :link_to
- # def link_to(name, options) ... end
- # makes the link_to controller method available in the view.
- def helper_method(*methods)
- methods.flatten.each do |method|
- master_helper_module.module_eval <<-end_eval
- def #{method}(*args, &block)
- controller.__send__(%(#{method}), *args, &block)
- end
- end_eval
- end
- end
-
- # Declare a controller attribute as a helper. For example,
- # helper_attr :name
- # attr_accessor :name
- # makes the name and name= controller methods available in the view.
- # The is a convenience wrapper for helper_method.
- def helper_attr(*attrs)
- attrs.flatten.each { |attr| helper_method(attr, "#{attr}=") }
- end
-
- private
- def inherited_with_helper(child)
- inherited_without_helper(child)
- begin
- child.master_helper_module = Module.new
- child.master_helper_module.__send__(:include, master_helper_module)
- child.helper child.name.to_s.underscore
- rescue MissingSourceFile => e
- raise unless e.is_missing?("helpers/#{child.name.to_s.underscore}_helper")
- end
- end
- end
-
- private
- # Extend the template class instance with our controller's helper module.
- def initialize_template_class_with_helper(assigns)
- initialize_template_class_without_helper(assigns).tap do |template|
- template.extend self.class.master_helper_module
- end
- end
- end
-end
diff --git a/vendor/rails/actionmailer/lib/action_mailer/mail_helper.rb b/vendor/rails/actionmailer/lib/action_mailer/mail_helper.rb
deleted file mode 100644
index 351b966a..00000000
--- a/vendor/rails/actionmailer/lib/action_mailer/mail_helper.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-module MailHelper
- # Uses Text::Format to take the text and format it, indented two spaces for
- # each line, and wrapped at 72 columns.
- def block_format(text)
- formatted = text.split(/\n\r\n/).collect { |paragraph|
- Text::Format.new(
- :columns => 72, :first_indent => 2, :body_indent => 2, :text => paragraph
- ).format
- }.join("\n")
-
- # Make list points stand on their own line
- formatted.gsub!(/[ ]*([*]+) ([^*]*)/) { |s| " #{$1} #{$2.strip}\n" }
- formatted.gsub!(/[ ]*([#]+) ([^#]*)/) { |s| " #{$1} #{$2.strip}\n" }
-
- formatted
- end
-end
diff --git a/vendor/rails/actionmailer/lib/action_mailer/part.rb b/vendor/rails/actionmailer/lib/action_mailer/part.rb
deleted file mode 100644
index 2bbb59cd..00000000
--- a/vendor/rails/actionmailer/lib/action_mailer/part.rb
+++ /dev/null
@@ -1,107 +0,0 @@
-module ActionMailer
- # Represents a subpart of an email message. It shares many similar
- # attributes of ActionMailer::Base. Although you can create parts manually
- # and add them to the +parts+ list of the mailer, it is easier
- # to use the helper methods in ActionMailer::PartContainer.
- class Part
- include AdvAttrAccessor, PartContainer, Utils
-
- # Represents the body of the part, as a string. This should not be a
- # Hash (like ActionMailer::Base), but if you want a template to be rendered
- # into the body of a subpart you can do it with the mailer's +render+ method
- # and assign the result here.
- adv_attr_accessor :body
-
- # Specify the charset for this subpart. By default, it will be the charset
- # of the containing part or mailer.
- adv_attr_accessor :charset
-
- # The content disposition of this part, typically either "inline" or
- # "attachment".
- adv_attr_accessor :content_disposition
-
- # The content type of the part.
- adv_attr_accessor :content_type
-
- # The filename to use for this subpart (usually for attachments).
- adv_attr_accessor :filename
-
- # Accessor for specifying additional headers to include with this part.
- adv_attr_accessor :headers
-
- # The transfer encoding to use for this subpart, like "base64" or
- # "quoted-printable".
- adv_attr_accessor :transfer_encoding
-
- # Create a new part from the given +params+ hash. The valid params keys
- # correspond to the accessors.
- def initialize(params)
- @content_type = params[:content_type]
- @content_disposition = params[:disposition] || "inline"
- @charset = params[:charset]
- @body = params[:body]
- @filename = params[:filename]
- @transfer_encoding = params[:transfer_encoding] || "quoted-printable"
- @headers = params[:headers] || {}
- @parts = []
- end
-
- # Convert the part to a mail object which can be included in the parts
- # list of another mail object.
- def to_mail(defaults)
- part = TMail::Mail.new
-
- real_content_type, ctype_attrs = parse_content_type(defaults)
-
- if @parts.empty?
- part.content_transfer_encoding = transfer_encoding || "quoted-printable"
- case (transfer_encoding || "").downcase
- when "base64" then
- part.body = TMail::Base64.folding_encode(body)
- when "quoted-printable"
- part.body = [normalize_new_lines(body)].pack("M*")
- else
- part.body = body
- end
-
- # Always set the content_type after setting the body and or parts!
- # Also don't set filename and name when there is none (like in
- # non-attachment parts)
- if content_disposition == "attachment"
- ctype_attrs.delete "charset"
- part.set_content_type(real_content_type, nil,
- squish("name" => filename).merge(ctype_attrs))
- part.set_content_disposition(content_disposition,
- squish("filename" => filename).merge(ctype_attrs))
- else
- part.set_content_type(real_content_type, nil, ctype_attrs)
- part.set_content_disposition(content_disposition)
- end
- else
- if String === body
- @parts.unshift Part.new(:charset => charset, :body => @body, :content_type => 'text/plain')
- @body = nil
- end
-
- @parts.each do |p|
- prt = (TMail::Mail === p ? p : p.to_mail(defaults))
- part.parts << prt
- end
-
- if real_content_type =~ /multipart/
- ctype_attrs.delete 'charset'
- part.set_content_type(real_content_type, nil, ctype_attrs)
- end
- end
-
- headers.each { |k,v| part[k] = v }
-
- part
- end
-
- private
- def squish(values={})
- values.delete_if { |k,v| v.nil? }
- end
- end
-end
diff --git a/vendor/rails/actionmailer/lib/action_mailer/part_container.rb b/vendor/rails/actionmailer/lib/action_mailer/part_container.rb
deleted file mode 100644
index abfd8f84..00000000
--- a/vendor/rails/actionmailer/lib/action_mailer/part_container.rb
+++ /dev/null
@@ -1,55 +0,0 @@
-module ActionMailer
- # Accessors and helpers that ActionMailer::Base and ActionMailer::Part have
- # in common. Using these helpers you can easily add subparts or attachments
- # to your message:
- #
- # def my_mail_message(...)
- # ...
- # part "text/plain" do |p|
- # p.body "hello, world"
- # p.transfer_encoding "base64"
- # end
- #
- # attachment "image/jpg" do |a|
- # a.body = File.read("hello.jpg")
- # a.filename = "hello.jpg"
- # end
- # end
- module PartContainer
- # The list of subparts of this container
- attr_reader :parts
-
- # Add a part to a multipart message, with the given content-type. The
- # part itself is yielded to the block so that other properties (charset,
- # body, headers, etc.) can be set on it.
- def part(params)
- params = {:content_type => params} if String === params
- part = Part.new(params)
- yield part if block_given?
- @parts << part
- end
-
- # Add an attachment to a multipart message. This is simply a part with the
- # content-disposition set to "attachment".
- def attachment(params, &block)
- params = { :content_type => params } if String === params
- params = { :disposition => "attachment",
- :transfer_encoding => "base64" }.merge(params)
- part(params, &block)
- end
-
- private
-
- def parse_content_type(defaults=nil)
- if content_type.blank?
- return defaults ?
- [ defaults.content_type, { 'charset' => defaults.charset } ] :
- [ nil, {} ]
- end
- ctype, *attrs = content_type.split(/;\s*/)
- attrs = attrs.inject({}) { |h,s| k,v = s.split(/=/, 2); h[k] = v; h }
- [ctype, {"charset" => charset || defaults && defaults.charset}.merge(attrs)]
- end
-
- end
-end
diff --git a/vendor/rails/actionmailer/lib/action_mailer/quoting.rb b/vendor/rails/actionmailer/lib/action_mailer/quoting.rb
deleted file mode 100644
index 5a32b652..00000000
--- a/vendor/rails/actionmailer/lib/action_mailer/quoting.rb
+++ /dev/null
@@ -1,62 +0,0 @@
-# encoding: us-ascii
-module ActionMailer
- module Quoting #:nodoc:
- # Convert the given text into quoted printable format, with an instruction
- # that the text be eventually interpreted in the given charset.
- def quoted_printable(text, charset)
- text = text.gsub( /[^a-z ]/i ) { quoted_printable_encode($&) }.
- gsub( / /, "_" )
- "=?#{charset}?Q?#{text}?="
- end
-
- # Convert the given character to quoted printable format, taking into
- # account multi-byte characters (if executing with $KCODE="u", for instance)
- def quoted_printable_encode(character)
- result = ""
- character.each_byte { |b| result << "=%02X" % b }
- result
- end
-
- # A quick-and-dirty regexp for determining whether a string contains any
- # characters that need escaping.
- if !defined?(CHARS_NEEDING_QUOTING)
- CHARS_NEEDING_QUOTING = /[\000-\011\013\014\016-\037\177-\377]/
- end
-
- # Quote the given text if it contains any "illegal" characters
- def quote_if_necessary(text, charset)
- text = text.dup.force_encoding(Encoding::ASCII_8BIT) if text.respond_to?(:force_encoding)
-
- (text =~ CHARS_NEEDING_QUOTING) ?
- quoted_printable(text, charset) :
- text
- end
-
- # Quote any of the given strings if they contain any "illegal" characters
- def quote_any_if_necessary(charset, *args)
- args.map { |v| quote_if_necessary(v, charset) }
- end
-
- # Quote the given address if it needs to be. The address may be a
- # regular email address, or it can be a phrase followed by an address in
- # brackets. The phrase is the only part that will be quoted, and only if
- # it needs to be. This allows extended characters to be used in the
- # "to", "from", "cc", "bcc" and "reply-to" headers.
- def quote_address_if_necessary(address, charset)
- if Array === address
- address.map { |a| quote_address_if_necessary(a, charset) }
- elsif address =~ /^(\S.*)\s+(<.*>)$/
- address = $2
- phrase = quote_if_necessary($1.gsub(/^['"](.*)['"]$/, '\1'), charset)
- "\"#{phrase}\" #{address}"
- else
- address
- end
- end
-
- # Quote any of the given addresses, if they need to be.
- def quote_any_address_if_necessary(charset, *args)
- args.map { |v| quote_address_if_necessary(v, charset) }
- end
- end
-end
diff --git a/vendor/rails/actionmailer/lib/action_mailer/test_case.rb b/vendor/rails/actionmailer/lib/action_mailer/test_case.rb
deleted file mode 100644
index 8035db6f..00000000
--- a/vendor/rails/actionmailer/lib/action_mailer/test_case.rb
+++ /dev/null
@@ -1,64 +0,0 @@
-require 'active_support/test_case'
-
-module ActionMailer
- class NonInferrableMailerError < ::StandardError
- def initialize(name)
- super "Unable to determine the mailer to test from #{name}. " +
- "You'll need to specify it using tests YourMailer in your " +
- "test case definition"
- end
- end
-
- class TestCase < ActiveSupport::TestCase
- include Quoting, TestHelper
-
- setup :initialize_test_deliveries
- setup :set_expected_mail
-
- class << self
- def tests(mailer)
- write_inheritable_attribute(:mailer_class, mailer)
- end
-
- def mailer_class
- if mailer = read_inheritable_attribute(:mailer_class)
- mailer
- else
- tests determine_default_mailer(name)
- end
- end
-
- def determine_default_mailer(name)
- name.sub(/Test$/, '').constantize
- rescue NameError => e
- raise NonInferrableMailerError.new(name)
- end
- end
-
- protected
- def initialize_test_deliveries
- ActionMailer::Base.delivery_method = :test
- ActionMailer::Base.perform_deliveries = true
- ActionMailer::Base.deliveries = []
- end
-
- def set_expected_mail
- @expected = TMail::Mail.new
- @expected.set_content_type "text", "plain", { "charset" => charset }
- @expected.mime_version = '1.0'
- end
-
- private
- def charset
- "utf-8"
- end
-
- def encode(subject)
- quoted_printable(subject, charset)
- end
-
- def read_fixture(action)
- IO.readlines(File.join(RAILS_ROOT, 'test', 'fixtures', self.class.mailer_class.name.underscore, action))
- end
- end
-end
diff --git a/vendor/rails/actionmailer/lib/action_mailer/test_helper.rb b/vendor/rails/actionmailer/lib/action_mailer/test_helper.rb
deleted file mode 100644
index f234c024..00000000
--- a/vendor/rails/actionmailer/lib/action_mailer/test_helper.rb
+++ /dev/null
@@ -1,68 +0,0 @@
-module ActionMailer
- module TestHelper
- # Asserts that the number of emails sent matches the given number.
- #
- # def test_emails
- # assert_emails 0
- # ContactMailer.deliver_contact
- # assert_emails 1
- # ContactMailer.deliver_contact
- # assert_emails 2
- # end
- #
- # If a block is passed, that block should cause the specified number of emails to be sent.
- #
- # def test_emails_again
- # assert_emails 1 do
- # ContactMailer.deliver_contact
- # end
- #
- # assert_emails 2 do
- # ContactMailer.deliver_contact
- # ContactMailer.deliver_contact
- # end
- # end
- def assert_emails(number)
- if block_given?
- original_count = ActionMailer::Base.deliveries.size
- yield
- new_count = ActionMailer::Base.deliveries.size
- assert_equal original_count + number, new_count, "#{number} emails expected, but #{new_count - original_count} were sent"
- else
- assert_equal number, ActionMailer::Base.deliveries.size
- end
- end
-
- # Assert that no emails have been sent.
- #
- # def test_emails
- # assert_no_emails
- # ContactMailer.deliver_contact
- # assert_emails 1
- # end
- #
- # If a block is passed, that block should not cause any emails to be sent.
- #
- # def test_emails_again
- # assert_no_emails do
- # # No emails should be sent from this block
- # end
- # end
- #
- # Note: This assertion is simply a shortcut for:
- #
- # assert_emails 0
- def assert_no_emails(&block)
- assert_emails 0, &block
- end
- end
-end
-
-# TODO: Deprecate this
-module Test
- module Unit
- class TestCase
- include ActionMailer::TestHelper
- end
- end
-end
diff --git a/vendor/rails/actionmailer/lib/action_mailer/utils.rb b/vendor/rails/actionmailer/lib/action_mailer/utils.rb
deleted file mode 100644
index 26d2e60a..00000000
--- a/vendor/rails/actionmailer/lib/action_mailer/utils.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-module ActionMailer
- module Utils #:nodoc:
- def normalize_new_lines(text)
- text.to_s.gsub(/\r\n?/, "\n")
- end
- end
-end
diff --git a/vendor/rails/actionmailer/lib/action_mailer/vendor/text-format-0.6.3/text/format.rb b/vendor/rails/actionmailer/lib/action_mailer/vendor/text-format-0.6.3/text/format.rb
deleted file mode 100755
index 2d20c7a6..00000000
--- a/vendor/rails/actionmailer/lib/action_mailer/vendor/text-format-0.6.3/text/format.rb
+++ /dev/null
@@ -1,1466 +0,0 @@
-#--
-# Text::Format for Ruby
-# Version 0.63
-#
-# Copyright (c) 2002 - 2003 Austin Ziegler
-#
-# $Id: format.rb,v 1.1.1.1 2004/10/14 11:59:57 webster132 Exp $
-#
-# ==========================================================================
-# Revision History ::
-# YYYY.MM.DD Change ID Developer
-# Description
-# --------------------------------------------------------------------------
-# 2002.10.18 Austin Ziegler
-# Fixed a minor problem with tabs not being counted. Changed
-# abbreviations from Hash to Array to better suit Ruby's
-# capabilities. Fixed problems with the way that Array arguments
-# are handled in calls to the major object types, excepting in
-# Text::Format#expand and Text::Format#unexpand (these will
-# probably need to be fixed).
-# 2002.10.30 Austin Ziegler
-# Fixed the ordering of the <=> for binary tests. Fixed
-# Text::Format#expand and Text::Format#unexpand to handle array
-# arguments better.
-# 2003.01.24 Austin Ziegler
-# Fixed a problem with Text::Format::RIGHT_FILL handling where a
-# single word is larger than #columns. Removed Comparable
-# capabilities (<=> doesn't make sense; == does). Added Symbol
-# equivalents for the Hash initialization. Hash initialization has
-# been modified so that values are set as follows (Symbols are
-# highest priority; strings are middle; defaults are lowest):
-# @columns = arg[:columns] || arg['columns'] || @columns
-# Added #hard_margins, #split_rules, #hyphenator, and #split_words.
-# 2003.02.07 Austin Ziegler
-# Fixed the installer for proper case-sensitive handling.
-# 2003.03.28 Austin Ziegler
-# Added the ability for a hyphenator to receive the formatter
-# object. Fixed a bug for strings matching /\A\s*\Z/ failing
-# entirely. Fixed a test case failing under 1.6.8.
-# 2003.04.04 Austin Ziegler
-# Handle the case of hyphenators returning nil for first/rest.
-# 2003.09.17 Austin Ziegler
-# Fixed a problem where #paragraphs(" ") was raising
-# NoMethodError.
-#
-# ==========================================================================
-#++
-
-module Text #:nodoc:
- # Text::Format for Ruby is copyright 2002 - 2005 by Austin Ziegler. It
- # is available under Ruby's licence, the Perl Artistic licence, or the
- # GNU GPL version 2 (or at your option, any later version). As a
- # special exception, for use with official Rails (provided by the
- # rubyonrails.org development team) and any project created with
- # official Rails, the following alternative MIT-style licence may be
- # used:
- #
- # == Text::Format Licence for Rails and Rails Applications
- # Permission is hereby granted, free of charge, to any person
- # obtaining a copy of this software and associated documentation files
- # (the "Software"), to deal in the Software without restriction,
- # including without limitation the rights to use, copy, modify, merge,
- # publish, distribute, sublicense, and/or sell copies of the Software,
- # and to permit persons to whom the Software is furnished to do so,
- # subject to the following conditions:
- #
- # * The names of its contributors may not be used to endorse or
- # promote products derived from this software without specific prior
- # written permission.
- #
- # The above copyright notice and this permission notice shall be
- # included in all copies or substantial portions of the Software.
- #
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- # SOFTWARE.
- class Format
- VERSION = '0.63'
-
- # Local abbreviations. More can be added with Text::Format.abbreviations
- ABBREV = [ 'Mr', 'Mrs', 'Ms', 'Jr', 'Sr' ]
-
- # Formatting values
- LEFT_ALIGN = 0
- RIGHT_ALIGN = 1
- RIGHT_FILL = 2
- JUSTIFY = 3
-
- # Word split modes (only applies when #hard_margins is true).
- SPLIT_FIXED = 1
- SPLIT_CONTINUATION = 2
- SPLIT_HYPHENATION = 4
- SPLIT_CONTINUATION_FIXED = SPLIT_CONTINUATION | SPLIT_FIXED
- SPLIT_HYPHENATION_FIXED = SPLIT_HYPHENATION | SPLIT_FIXED
- SPLIT_HYPHENATION_CONTINUATION = SPLIT_HYPHENATION | SPLIT_CONTINUATION
- SPLIT_ALL = SPLIT_HYPHENATION | SPLIT_CONTINUATION | SPLIT_FIXED
-
- # Words forcibly split by Text::Format will be stored as split words.
- # This class represents a word forcibly split.
- class SplitWord
- # The word that was split.
- attr_reader :word
- # The first part of the word that was split.
- attr_reader :first
- # The remainder of the word that was split.
- attr_reader :rest
-
- def initialize(word, first, rest) #:nodoc:
- @word = word
- @first = first
- @rest = rest
- end
- end
-
- private
- LEQ_RE = /[.?!]['"]?$/
-
- def brk_re(i) #:nodoc:
- %r/((?:\S+\s+){#{i}})(.+)/
- end
-
- def posint(p) #:nodoc:
- p.to_i.abs
- end
-
- public
- # Compares two Text::Format objects. All settings of the objects are
- # compared *except* #hyphenator. Generated results (e.g., #split_words)
- # are not compared, either.
- def ==(o)
- (@text == o.text) &&
- (@columns == o.columns) &&
- (@left_margin == o.left_margin) &&
- (@right_margin == o.right_margin) &&
- (@hard_margins == o.hard_margins) &&
- (@split_rules == o.split_rules) &&
- (@first_indent == o.first_indent) &&
- (@body_indent == o.body_indent) &&
- (@tag_text == o.tag_text) &&
- (@tabstop == o.tabstop) &&
- (@format_style == o.format_style) &&
- (@extra_space == o.extra_space) &&
- (@tag_paragraph == o.tag_paragraph) &&
- (@nobreak == o.nobreak) &&
- (@abbreviations == o.abbreviations) &&
- (@nobreak_regex == o.nobreak_regex)
- end
-
- # The text to be manipulated. Note that value is optional, but if the
- # formatting functions are called without values, this text is what will
- # be formatted.
- #
- # *Default*:: []
- # Used in:: All methods
- attr_accessor :text
-
- # The total width of the format area. The margins, indentation, and text
- # are formatted into this space.
- #
- # COLUMNS
- # <-------------------------------------------------------------->
- # <-----------><------><---------------------------><------------>
- # left margin indent text is formatted into here right margin
- #
- # *Default*:: 72
- # Used in:: #format, #paragraphs,
- # #center
- attr_reader :columns
-
- # The total width of the format area. The margins, indentation, and text
- # are formatted into this space. The value provided is silently
- # converted to a positive integer.
- #
- # COLUMNS
- # <-------------------------------------------------------------->
- # <-----------><------><---------------------------><------------>
- # left margin indent text is formatted into here right margin
- #
- # *Default*:: 72
- # Used in:: #format, #paragraphs,
- # #center
- def columns=(c)
- @columns = posint(c)
- end
-
- # The number of spaces used for the left margin.
- #
- # columns
- # <-------------------------------------------------------------->
- # <-----------><------><---------------------------><------------>
- # LEFT MARGIN indent text is formatted into here right margin
- #
- # *Default*:: 0
- # Used in:: #format, #paragraphs,
- # #center
- attr_reader :left_margin
-
- # The number of spaces used for the left margin. The value provided is
- # silently converted to a positive integer value.
- #
- # columns
- # <-------------------------------------------------------------->
- # <-----------><------><---------------------------><------------>
- # LEFT MARGIN indent text is formatted into here right margin
- #
- # *Default*:: 0
- # Used in:: #format, #paragraphs,
- # #center
- def left_margin=(left)
- @left_margin = posint(left)
- end
-
- # The number of spaces used for the right margin.
- #
- # columns
- # <-------------------------------------------------------------->
- # <-----------><------><---------------------------><------------>
- # left margin indent text is formatted into here RIGHT MARGIN
- #
- # *Default*:: 0
- # Used in:: #format, #paragraphs,
- # #center
- attr_reader :right_margin
-
- # The number of spaces used for the right margin. The value provided is
- # silently converted to a positive integer value.
- #
- # columns
- # <-------------------------------------------------------------->
- # <-----------><------><---------------------------><------------>
- # left margin indent text is formatted into here RIGHT MARGIN
- #
- # *Default*:: 0
- # Used in:: #format, #paragraphs,
- # #center
- def right_margin=(r)
- @right_margin = posint(r)
- end
-
- # The number of spaces to indent the first line of a paragraph.
- #
- # columns
- # <-------------------------------------------------------------->
- # <-----------><------><---------------------------><------------>
- # left margin INDENT text is formatted into here right margin
- #
- # *Default*:: 4
- # Used in:: #format, #paragraphs
- attr_reader :first_indent
-
- # The number of spaces to indent the first line of a paragraph. The
- # value provided is silently converted to a positive integer value.
- #
- # columns
- # <-------------------------------------------------------------->
- # <-----------><------><---------------------------><------------>
- # left margin INDENT text is formatted into here right margin
- #
- # *Default*:: 4
- # Used in:: #format, #paragraphs
- def first_indent=(f)
- @first_indent = posint(f)
- end
-
- # The number of spaces to indent all lines after the first line of a
- # paragraph.
- #
- # columns
- # <-------------------------------------------------------------->
- # <-----------><------><---------------------------><------------>
- # left margin INDENT text is formatted into here right margin
- #
- # *Default*:: 0
- # Used in:: #format, #paragraphs
- attr_reader :body_indent
-
- # The number of spaces to indent all lines after the first line of
- # a paragraph. The value provided is silently converted to a
- # positive integer value.
- #
- # columns
- # <-------------------------------------------------------------->
- # <-----------><------><---------------------------><------------>
- # left margin INDENT text is formatted into here right margin
- #
- # *Default*:: 0
- # Used in:: #format, #paragraphs
- def body_indent=(b)
- @body_indent = posint(b)
- end
-
- # Normally, words larger than the format area will be placed on a line
- # by themselves. Setting this to +true+ will force words larger than the
- # format area to be split into one or more "words" each at most the size
- # of the format area. The first line and the original word will be
- # placed into #split_words. Note that this will cause the
- # output to look *similar* to a #format_style of JUSTIFY. (Lines will be
- # filled as much as possible.)
- #
- # *Default*:: +false+
- # Used in:: #format, #paragraphs
- attr_accessor :hard_margins
-
- # An array of words split during formatting if #hard_margins is set to
- # +true+.
- # #split_words << Text::Format::SplitWord.new(word, first, rest)
- attr_reader :split_words
-
- # The object responsible for hyphenating. It must respond to
- # #hyphenate_to(word, size) or #hyphenate_to(word, size, formatter) and
- # return an array of the word split into two parts; if there is a
- # hyphenation mark to be applied, responsibility belongs to the
- # hyphenator object. The size is the MAXIMUM size permitted, including
- # any hyphenation marks. If the #hyphenate_to method has an arity of 3,
- # the formatter will be provided to the method. This allows the
- # hyphenator to make decisions about the hyphenation based on the
- # formatting rules.
- #
- # *Default*:: +nil+
- # Used in:: #format, #paragraphs
- attr_reader :hyphenator
-
- # The object responsible for hyphenating. It must respond to
- # #hyphenate_to(word, size) and return an array of the word hyphenated
- # into two parts. The size is the MAXIMUM size permitted, including any
- # hyphenation marks.
- #
- # *Default*:: +nil+
- # Used in:: #format, #paragraphs
- def hyphenator=(h)
- raise ArgumentError, "#{h.inspect} is not a valid hyphenator." unless h.respond_to?(:hyphenate_to)
- arity = h.method(:hyphenate_to).arity
- raise ArgumentError, "#{h.inspect} must have exactly two or three arguments." unless [2, 3].include?(arity)
- @hyphenator = h
- @hyphenator_arity = arity
- end
-
- # Specifies the split mode; used only when #hard_margins is set to
- # +true+. Allowable values are:
- # [+SPLIT_FIXED+] The word will be split at the number of
- # characters needed, with no marking at all.
- # repre
- # senta
- # ion
- # [+SPLIT_CONTINUATION+] The word will be split at the number of
- # characters needed, with a C-style continuation
- # character. If a word is the only item on a
- # line and it cannot be split into an
- # appropriate size, SPLIT_FIXED will be used.
- # repr\
- # esen\
- # tati\
- # on
- # [+SPLIT_HYPHENATION+] The word will be split according to the
- # hyphenator specified in #hyphenator. If there
- # is no #hyphenator specified, works like
- # SPLIT_CONTINUATION. The example is using
- # TeX::Hyphen. If a word is the only item on a
- # line and it cannot be split into an
- # appropriate size, SPLIT_CONTINUATION mode will
- # be used.
- # rep-
- # re-
- # sen-
- # ta-
- # tion
- #
- # *Default*:: Text::Format::SPLIT_FIXED
- # Used in:: #format, #paragraphs
- attr_reader :split_rules
-
- # Specifies the split mode; used only when #hard_margins is set to
- # +true+. Allowable values are:
- # [+SPLIT_FIXED+] The word will be split at the number of
- # characters needed, with no marking at all.
- # repre
- # senta
- # ion
- # [+SPLIT_CONTINUATION+] The word will be split at the number of
- # characters needed, with a C-style continuation
- # character.
- # repr\
- # esen\
- # tati\
- # on
- # [+SPLIT_HYPHENATION+] The word will be split according to the
- # hyphenator specified in #hyphenator. If there
- # is no #hyphenator specified, works like
- # SPLIT_CONTINUATION. The example is using
- # TeX::Hyphen as the #hyphenator.
- # rep-
- # re-
- # sen-
- # ta-
- # tion
- #
- # These values can be bitwise ORed together (e.g., SPLIT_FIXED |
- # SPLIT_CONTINUATION) to provide fallback split methods. In the
- # example given, an attempt will be made to split the word using the
- # rules of SPLIT_CONTINUATION; if there is not enough room, the word
- # will be split with the rules of SPLIT_FIXED. These combinations are
- # also available as the following values:
- # * +SPLIT_CONTINUATION_FIXED+
- # * +SPLIT_HYPHENATION_FIXED+
- # * +SPLIT_HYPHENATION_CONTINUATION+
- # * +SPLIT_ALL+
- #
- # *Default*:: Text::Format::SPLIT_FIXED
- # Used in:: #format, #paragraphs
- def split_rules=(s)
- raise ArgumentError, "Invalid value provided for split_rules." if ((s < SPLIT_FIXED) || (s > SPLIT_ALL))
- @split_rules = s
- end
-
- # Indicates whether sentence terminators should be followed by a single
- # space (+false+), or two spaces (+true+).
- #
- # *Default*:: +false+
- # Used in:: #format, #paragraphs
- attr_accessor :extra_space
-
- # Defines the current abbreviations as an array. This is only used if
- # extra_space is turned on.
- #
- # If one is abbreviating "President" as "Pres." (abbreviations =
- # ["Pres"]), then the results of formatting will be as illustrated in
- # the table below:
- #
- # extra_space | include? | !include?
- # true | Pres. Lincoln | Pres. Lincoln
- # false | Pres. Lincoln | Pres. Lincoln
- #
- # *Default*:: {}
- # Used in:: #format, #paragraphs
- attr_accessor :abbreviations
-
- # Indicates whether the formatting of paragraphs should be done with
- # tagged paragraphs. Useful only with #tag_text.
- #
- # *Default*:: +false+
- # Used in:: #format, #paragraphs
- attr_accessor :tag_paragraph
-
- # The array of text to be placed before each paragraph when
- # #tag_paragraph is +true+. When #format() is called,
- # only the first element of the array is used. When #paragraphs
- # is called, then each entry in the array will be used once, with
- # corresponding paragraphs. If the tag elements are exhausted before the
- # text is exhausted, then the remaining paragraphs will not be tagged.
- # Regardless of indentation settings, a blank line will be inserted
- # between all paragraphs when #tag_paragraph is +true+.
- #
- # *Default*:: []
- # Used in:: #format, #paragraphs
- attr_accessor :tag_text
-
- # Indicates whether or not the non-breaking space feature should be
- # used.
- #
- # *Default*:: +false+
- # Used in:: #format, #paragraphs
- attr_accessor :nobreak
-
- # A hash which holds the regular expressions on which spaces should not
- # be broken. The hash is set up such that the key is the first word and
- # the value is the second word.
- #
- # For example, if +nobreak_regex+ contains the following hash:
- #
- # { '^Mrs?\.$' => '\S+$', '^\S+$' => '^(?:S|J)r\.$'}
- #
- # Then "Mr. Jones", "Mrs. Jones", and "Jones Jr." would not be broken.
- # If this simple matching algorithm indicates that there should not be a
- # break at the current end of line, then a backtrack is done until there
- # are two words on which line breaking is permitted. If two such words
- # are not found, then the end of the line will be broken *regardless*.
- # If there is a single word on the current line, then no backtrack is
- # done and the word is stuck on the end.
- #
- # *Default*:: {}
- # Used in:: #format, #paragraphs
- attr_accessor :nobreak_regex
-
- # Indicates the number of spaces that a single tab represents.
- #
- # *Default*:: 8
- # Used in:: #expand, #unexpand,
- # #paragraphs
- attr_reader :tabstop
-
- # Indicates the number of spaces that a single tab represents.
- #
- # *Default*:: 8
- # Used in:: #expand, #unexpand,
- # #paragraphs
- def tabstop=(t)
- @tabstop = posint(t)
- end
-
- # Specifies the format style. Allowable values are:
- # [+LEFT_ALIGN+] Left justified, ragged right.
- # |A paragraph that is|
- # |left aligned.|
- # [+RIGHT_ALIGN+] Right justified, ragged left.
- # |A paragraph that is|
- # | right aligned.|
- # [+RIGHT_FILL+] Left justified, right ragged, filled to width by
- # spaces. (Essentially the same as +LEFT_ALIGN+ except
- # that lines are padded on the right.)
- # |A paragraph that is|
- # |left aligned. |
- # [+JUSTIFY+] Fully justified, words filled to width by spaces,
- # except the last line.
- # |A paragraph that|
- # |is justified.|
- #
- # *Default*:: Text::Format::LEFT_ALIGN
- # Used in:: #format, #paragraphs
- attr_reader :format_style
-
- # Specifies the format style. Allowable values are:
- # [+LEFT_ALIGN+] Left justified, ragged right.
- # |A paragraph that is|
- # |left aligned.|
- # [+RIGHT_ALIGN+] Right justified, ragged left.
- # |A paragraph that is|
- # | right aligned.|
- # [+RIGHT_FILL+] Left justified, right ragged, filled to width by
- # spaces. (Essentially the same as +LEFT_ALIGN+ except
- # that lines are padded on the right.)
- # |A paragraph that is|
- # |left aligned. |
- # [+JUSTIFY+] Fully justified, words filled to width by spaces.
- # |A paragraph that|
- # |is justified.|
- #
- # *Default*:: Text::Format::LEFT_ALIGN
- # Used in:: #format, #paragraphs
- def format_style=(fs)
- raise ArgumentError, "Invalid value provided for format_style." if ((fs < LEFT_ALIGN) || (fs > JUSTIFY))
- @format_style = fs
- end
-
- # Indicates that the format style is left alignment.
- #
- # *Default*:: +true+
- # Used in:: #format, #paragraphs
- def left_align?
- return @format_style == LEFT_ALIGN
- end
-
- # Indicates that the format style is right alignment.
- #
- # *Default*:: +false+
- # Used in:: #format, #paragraphs
- def right_align?
- return @format_style == RIGHT_ALIGN
- end
-
- # Indicates that the format style is right fill.
- #
- # *Default*:: +false+
- # Used in:: #format, #paragraphs
- def right_fill?
- return @format_style == RIGHT_FILL
- end
-
- # Indicates that the format style is full justification.
- #
- # *Default*:: +false+
- # Used in:: #format, #paragraphs
- def justify?
- return @format_style == JUSTIFY
- end
-
- # The default implementation of #hyphenate_to implements
- # SPLIT_CONTINUATION.
- def hyphenate_to(word, size)
- [word[0 .. (size - 2)] + "\\", word[(size - 1) .. -1]]
- end
-
- private
- def __do_split_word(word, size) #:nodoc:
- [word[0 .. (size - 1)], word[size .. -1]]
- end
-
- def __format(to_wrap) #:nodoc:
- words = to_wrap.split(/\s+/).compact
- words.shift if words[0].nil? or words[0].empty?
- to_wrap = []
-
- abbrev = false
- width = @columns - @first_indent - @left_margin - @right_margin
- indent_str = ' ' * @first_indent
- first_line = true
- line = words.shift
- abbrev = __is_abbrev(line) unless line.nil? || line.empty?
-
- while w = words.shift
- if (w.size + line.size < (width - 1)) ||
- ((line !~ LEQ_RE || abbrev) && (w.size + line.size < width))
- line << " " if (line =~ LEQ_RE) && (not abbrev)
- line << " #{w}"
- else
- line, w = __do_break(line, w) if @nobreak
- line, w = __do_hyphenate(line, w, width) if @hard_margins
- if w.index(/\s+/)
- w, *w2 = w.split(/\s+/)
- words.unshift(w2)
- words.flatten!
- end
- to_wrap << __make_line(line, indent_str, width, w.nil?) unless line.nil?
- if first_line
- first_line = false
- width = @columns - @body_indent - @left_margin - @right_margin
- indent_str = ' ' * @body_indent
- end
- line = w
- end
-
- abbrev = __is_abbrev(w) unless w.nil?
- end
-
- loop do
- break if line.nil? or line.empty?
- line, w = __do_hyphenate(line, w, width) if @hard_margins
- to_wrap << __make_line(line, indent_str, width, w.nil?)
- line = w
- end
-
- if (@tag_paragraph && (to_wrap.size > 0)) then
- clr = %r{`(\w+)'}.match([caller(1)].flatten[0])[1]
- clr = "" if clr.nil?
-
- if ((not @tag_text[0].nil?) && (@tag_cur.size < 1) &&
- (clr != "__paragraphs")) then
- @tag_cur = @tag_text[0]
- end
-
- fchar = /(\S)/.match(to_wrap[0])[1]
- white = to_wrap[0].index(fchar)
- if ((white - @left_margin - 1) > @tag_cur.size) then
- white = @tag_cur.size + @left_margin
- to_wrap[0].gsub!(/^ {#{white}}/, "#{' ' * @left_margin}#{@tag_cur}")
- else
- to_wrap.unshift("#{' ' * @left_margin}#{@tag_cur}\n")
- end
- end
- to_wrap.join('')
- end
-
- # format lines in text into paragraphs with each element of @wrap a
- # paragraph; uses Text::Format.format for the formatting
- def __paragraphs(to_wrap) #:nodoc:
- if ((@first_indent == @body_indent) || @tag_paragraph) then
- p_end = "\n"
- else
- p_end = ''
- end
-
- cnt = 0
- ret = []
- to_wrap.each do |tw|
- @tag_cur = @tag_text[cnt] if @tag_paragraph
- @tag_cur = '' if @tag_cur.nil?
- line = __format(tw)
- ret << "#{line}#{p_end}" if (not line.nil?) && (line.size > 0)
- cnt += 1
- end
-
- ret[-1].chomp! unless ret.empty?
- ret.join('')
- end
-
- # center text using spaces on left side to pad it out empty lines
- # are preserved
- def __center(to_center) #:nodoc:
- tabs = 0
- width = @columns - @left_margin - @right_margin
- centered = []
- to_center.each do |tc|
- s = tc.strip
- tabs = s.count("\t")
- tabs = 0 if tabs.nil?
- ct = ((width - s.size - (tabs * @tabstop) + tabs) / 2)
- ct = (width - @left_margin - @right_margin) - ct
- centered << "#{s.rjust(ct)}\n"
- end
- centered.join('')
- end
-
- # expand tabs to spaces should be similar to Text::Tabs::expand
- def __expand(to_expand) #:nodoc:
- expanded = []
- to_expand.split("\n").each { |te| expanded << te.gsub(/\t/, ' ' * @tabstop) }
- expanded.join('')
- end
-
- def __unexpand(to_unexpand) #:nodoc:
- unexpanded = []
- to_unexpand.split("\n").each { |tu| unexpanded << tu.gsub(/ {#{@tabstop}}/, "\t") }
- unexpanded.join('')
- end
-
- def __is_abbrev(word) #:nodoc:
- # remove period if there is one.
- w = word.gsub(/\.$/, '') unless word.nil?
- return true if (!@extra_space || ABBREV.include?(w) || @abbreviations.include?(w))
- false
- end
-
- def __make_line(line, indent, width, last = false) #:nodoc:
- lmargin = " " * @left_margin
- fill = " " * (width - line.size) if right_fill? && (line.size <= width)
-
- if (justify? && ((not line.nil?) && (not line.empty?)) && line =~ /\S+\s+\S+/ && !last)
- spaces = width - line.size
- words = line.split(/(\s+)/)
- ws = spaces / (words.size / 2)
- spaces = spaces % (words.size / 2) if ws > 0
- words.reverse.each do |rw|
- next if (rw =~ /^\S/)
- rw.sub!(/^/, " " * ws)
- next unless (spaces > 0)
- rw.sub!(/^/, " ")
- spaces -= 1
- end
- line = words.join('')
- end
- line = "#{lmargin}#{indent}#{line}#{fill}\n" unless line.nil?
- if right_align? && (not line.nil?)
- line.sub(/^/, " " * (@columns - @right_margin - (line.size - 1)))
- else
- line
- end
- end
-
- def __do_hyphenate(line, next_line, width) #:nodoc:
- rline = line.dup rescue line
- rnext = next_line.dup rescue next_line
- loop do
- if rline.size == width
- break
- elsif rline.size > width
- words = rline.strip.split(/\s+/)
- word = words[-1].dup
- size = width - rline.size + word.size
- if (size <= 0)
- words[-1] = nil
- rline = words.join(' ').strip
- rnext = "#{word} #{rnext}".strip
- next
- end
-
- first = rest = nil
-
- if ((@split_rules & SPLIT_HYPHENATION) != 0)
- if @hyphenator_arity == 2
- first, rest = @hyphenator.hyphenate_to(word, size)
- else
- first, rest = @hyphenator.hyphenate_to(word, size, self)
- end
- end
-
- if ((@split_rules & SPLIT_CONTINUATION) != 0) and first.nil?
- first, rest = self.hyphenate_to(word, size)
- end
-
- if ((@split_rules & SPLIT_FIXED) != 0) and first.nil?
- first.nil? or @split_rules == SPLIT_FIXED
- first, rest = __do_split_word(word, size)
- end
-
- if first.nil?
- words[-1] = nil
- rest = word
- else
- words[-1] = first
- @split_words << SplitWord.new(word, first, rest)
- end
- rline = words.join(' ').strip
- rnext = "#{rest} #{rnext}".strip
- break
- else
- break if rnext.nil? or rnext.empty? or rline.nil? or rline.empty?
- words = rnext.split(/\s+/)
- word = words.shift
- size = width - rline.size - 1
-
- if (size <= 0)
- rnext = "#{word} #{words.join(' ')}".strip
- break
- end
-
- first = rest = nil
-
- if ((@split_rules & SPLIT_HYPHENATION) != 0)
- if @hyphenator_arity == 2
- first, rest = @hyphenator.hyphenate_to(word, size)
- else
- first, rest = @hyphenator.hyphenate_to(word, size, self)
- end
- end
-
- first, rest = self.hyphenate_to(word, size) if ((@split_rules & SPLIT_CONTINUATION) != 0) and first.nil?
-
- first, rest = __do_split_word(word, size) if ((@split_rules & SPLIT_FIXED) != 0) and first.nil?
-
- if (rline.size + (first ? first.size : 0)) < width
- @split_words << SplitWord.new(word, first, rest)
- rline = "#{rline} #{first}".strip
- rnext = "#{rest} #{words.join(' ')}".strip
- end
- break
- end
- end
- [rline, rnext]
- end
-
- def __do_break(line, next_line) #:nodoc:
- no_brk = false
- words = []
- words = line.split(/\s+/) unless line.nil?
- last_word = words[-1]
-
- @nobreak_regex.each { |k, v| no_brk = ((last_word =~ /#{k}/) and (next_line =~ /#{v}/)) }
-
- if no_brk && words.size > 1
- i = words.size
- while i > 0
- no_brk = false
- @nobreak_regex.each { |k, v| no_brk = ((words[i + 1] =~ /#{k}/) && (words[i] =~ /#{v}/)) }
- i -= 1
- break if not no_brk
- end
- if i > 0
- l = brk_re(i).match(line)
- line.sub!(brk_re(i), l[1])
- next_line = "#{l[2]} #{next_line}"
- line.sub!(/\s+$/, '')
- end
- end
- [line, next_line]
- end
-
- def __create(arg = nil, &block) #:nodoc:
- # Format::Text.new(text-to-wrap)
- @text = arg unless arg.nil?
- # Defaults
- @columns = 72
- @tabstop = 8
- @first_indent = 4
- @body_indent = 0
- @format_style = LEFT_ALIGN
- @left_margin = 0
- @right_margin = 0
- @extra_space = false
- @text = Array.new if @text.nil?
- @tag_paragraph = false
- @tag_text = Array.new
- @tag_cur = ""
- @abbreviations = Array.new
- @nobreak = false
- @nobreak_regex = Hash.new
- @split_words = Array.new
- @hard_margins = false
- @split_rules = SPLIT_FIXED
- @hyphenator = self
- @hyphenator_arity = self.method(:hyphenate_to).arity
-
- instance_eval(&block) unless block.nil?
- end
-
- public
- # Formats text into a nice paragraph format. The text is separated
- # into words and then reassembled a word at a time using the settings
- # of this Format object. If a word is larger than the number of
- # columns available for formatting, then that word will appear on the
- # line by itself.
- #
- # If +to_wrap+ is +nil+, then the value of #text will be
- # worked on.
- def format(to_wrap = nil)
- to_wrap = @text if to_wrap.nil?
- if to_wrap.class == Array
- __format(to_wrap[0])
- else
- __format(to_wrap)
- end
- end
-
- # Considers each element of text (provided or internal) as a paragraph.
- # If #first_indent is the same as #body_indent, then
- # paragraphs will be separated by a single empty line in the result;
- # otherwise, the paragraphs will follow immediately after each other.
- # Uses #format to do the heavy lifting.
- def paragraphs(to_wrap = nil)
- to_wrap = @text if to_wrap.nil?
- __paragraphs([to_wrap].flatten)
- end
-
- # Centers the text, preserving empty lines and tabs.
- def center(to_center = nil)
- to_center = @text if to_center.nil?
- __center([to_center].flatten)
- end
-
- # Replaces all tab characters in the text with #tabstop spaces.
- def expand(to_expand = nil)
- to_expand = @text if to_expand.nil?
- if to_expand.class == Array
- to_expand.collect { |te| __expand(te) }
- else
- __expand(to_expand)
- end
- end
-
- # Replaces all occurrences of #tabstop consecutive spaces
- # with a tab character.
- def unexpand(to_unexpand = nil)
- to_unexpand = @text if to_unexpand.nil?
- if to_unexpand.class == Array
- to_unexpand.collect { |te| v << __unexpand(te) }
- else
- __unexpand(to_unexpand)
- end
- end
-
- # This constructor takes advantage of a technique for Ruby object
- # construction introduced by Andy Hunt and Dave Thomas (see reference),
- # where optional values are set using commands in a block.
- #
- # Text::Format.new {
- # columns = 72
- # left_margin = 0
- # right_margin = 0
- # first_indent = 4
- # body_indent = 0
- # format_style = Text::Format::LEFT_ALIGN
- # extra_space = false
- # abbreviations = {}
- # tag_paragraph = false
- # tag_text = []
- # nobreak = false
- # nobreak_regex = {}
- # tabstop = 8
- # text = nil
- # }
- #
- # As shown above, +arg+ is optional. If +arg+ is specified and is a
- # +String+, then arg is used as the default value of #text.
- # Alternately, an existing Text::Format object can be used or a Hash can
- # be used. With all forms, a block can be specified.
- #
- # *Reference*:: "Object Construction and Blocks"
- #
- #
- def initialize(arg = nil, &block)
- case arg
- when Text::Format
- __create(arg.text) do
- @columns = arg.columns
- @tabstop = arg.tabstop
- @first_indent = arg.first_indent
- @body_indent = arg.body_indent
- @format_style = arg.format_style
- @left_margin = arg.left_margin
- @right_margin = arg.right_margin
- @extra_space = arg.extra_space
- @tag_paragraph = arg.tag_paragraph
- @tag_text = arg.tag_text
- @abbreviations = arg.abbreviations
- @nobreak = arg.nobreak
- @nobreak_regex = arg.nobreak_regex
- @text = arg.text
- @hard_margins = arg.hard_margins
- @split_words = arg.split_words
- @split_rules = arg.split_rules
- @hyphenator = arg.hyphenator
- end
- instance_eval(&block) unless block.nil?
- when Hash
- __create do
- @columns = arg[:columns] || arg['columns'] || @columns
- @tabstop = arg[:tabstop] || arg['tabstop'] || @tabstop
- @first_indent = arg[:first_indent] || arg['first_indent'] || @first_indent
- @body_indent = arg[:body_indent] || arg['body_indent'] || @body_indent
- @format_style = arg[:format_style] || arg['format_style'] || @format_style
- @left_margin = arg[:left_margin] || arg['left_margin'] || @left_margin
- @right_margin = arg[:right_margin] || arg['right_margin'] || @right_margin
- @extra_space = arg[:extra_space] || arg['extra_space'] || @extra_space
- @text = arg[:text] || arg['text'] || @text
- @tag_paragraph = arg[:tag_paragraph] || arg['tag_paragraph'] || @tag_paragraph
- @tag_text = arg[:tag_text] || arg['tag_text'] || @tag_text
- @abbreviations = arg[:abbreviations] || arg['abbreviations'] || @abbreviations
- @nobreak = arg[:nobreak] || arg['nobreak'] || @nobreak
- @nobreak_regex = arg[:nobreak_regex] || arg['nobreak_regex'] || @nobreak_regex
- @hard_margins = arg[:hard_margins] || arg['hard_margins'] || @hard_margins
- @split_rules = arg[:split_rules] || arg['split_rules'] || @split_rules
- @hyphenator = arg[:hyphenator] || arg['hyphenator'] || @hyphenator
- end
- instance_eval(&block) unless block.nil?
- when String
- __create(arg, &block)
- when NilClass
- __create(&block)
- else
- raise TypeError
- end
- end
- end
-end
-
-if __FILE__ == $0
- require 'test/unit'
-
- class TestText__Format < Test::Unit::TestCase #:nodoc:
- attr_accessor :format_o
-
- GETTYSBURG = <<-'EOS'
- Four score and seven years ago our fathers brought forth on this
- continent a new nation, conceived in liberty and dedicated to the
- proposition that all men are created equal. Now we are engaged in
- a great civil war, testing whether that nation or any nation so
- conceived and so dedicated can long endure. We are met on a great
- battlefield of that war. We have come to dedicate a portion of
- that field as a final resting-place for those who here gave their
- lives that that nation might live. It is altogether fitting and
- proper that we should do this. But in a larger sense, we cannot
- dedicate, we cannot consecrate, we cannot hallow this ground.
- The brave men, living and dead who struggled here have consecrated
- it far above our poor power to add or detract. The world will
- little note nor long remember what we say here, but it can never
- forget what they did here. It is for us the living rather to be
- dedicated here to the unfinished work which they who fought here
- have thus far so nobly advanced. It is rather for us to be here
- dedicated to the great task remaining before us--that from these
- honored dead we take increased devotion to that cause for which
- they gave the last full measure of devotion--that we here highly
- resolve that these dead shall not have died in vain, that this
- nation under God shall have a new birth of freedom, and that
- government of the people, by the people, for the people shall
- not perish from the earth.
-
- -- Pres. Abraham Lincoln, 19 November 1863
- EOS
-
- FIVE_COL = "Four \nscore\nand s\neven \nyears\nago o\nur fa\nthers\nbroug\nht fo\nrth o\nn thi\ns con\ntinen\nt a n\new na\ntion,\nconce\nived \nin li\nberty\nand d\nedica\nted t\no the\npropo\nsitio\nn tha\nt all\nmen a\nre cr\neated\nequal\n. Now\nwe ar\ne eng\naged \nin a \ngreat\ncivil\nwar, \ntesti\nng wh\nether\nthat \nnatio\nn or \nany n\nation\nso co\nnceiv\ned an\nd so \ndedic\nated \ncan l\nong e\nndure\n. We \nare m\net on\na gre\nat ba\nttlef\nield \nof th\nat wa\nr. We\nhave \ncome \nto de\ndicat\ne a p\nortio\nn of \nthat \nfield\nas a \nfinal\nresti\nng-pl\nace f\nor th\nose w\nho he\nre ga\nve th\neir l\nives \nthat \nthat \nnatio\nn mig\nht li\nve. I\nt is \naltog\nether\nfitti\nng an\nd pro\nper t\nhat w\ne sho\nuld d\no thi\ns. Bu\nt in \na lar\nger s\nense,\nwe ca\nnnot \ndedic\nate, \nwe ca\nnnot \nconse\ncrate\n, we \ncanno\nt hal\nlow t\nhis g\nround\n. The\nbrave\nmen, \nlivin\ng and\ndead \nwho s\ntrugg\nled h\nere h\nave c\nonsec\nrated\nit fa\nr abo\nve ou\nr poo\nr pow\ner to\nadd o\nr det\nract.\nThe w\norld \nwill \nlittl\ne not\ne nor\nlong \nremem\nber w\nhat w\ne say\nhere,\nbut i\nt can\nnever\nforge\nt wha\nt the\ny did\nhere.\nIt is\nfor u\ns the\nlivin\ng rat\nher t\no be \ndedic\nated \nhere \nto th\ne unf\ninish\ned wo\nrk wh\nich t\nhey w\nho fo\nught \nhere \nhave \nthus \nfar s\no nob\nly ad\nvance\nd. It\nis ra\nther \nfor u\ns to \nbe he\nre de\ndicat\ned to\nthe g\nreat \ntask \nremai\nning \nbefor\ne us-\n-that\nfrom \nthese\nhonor\ned de\nad we\ntake \nincre\nased \ndevot\nion t\no tha\nt cau\nse fo\nr whi\nch th\ney ga\nve th\ne las\nt ful\nl mea\nsure \nof de\nvotio\nn--th\nat we\nhere \nhighl\ny res\nolve \nthat \nthese\ndead \nshall\nnot h\nave d\nied i\nn vai\nn, th\nat th\nis na\ntion \nunder\nGod s\nhall \nhave \na new\nbirth\nof fr\needom\n, and\nthat \ngover\nnment\nof th\ne peo\nple, \nby th\ne peo\nple, \nfor t\nhe pe\nople \nshall\nnot p\nerish\nfrom \nthe e\narth.\n-- Pr\nes. A\nbraha\nm Lin\ncoln,\n19 No\nvembe\nr 186\n3 \n"
-
- FIVE_CNT = "Four \nscore\nand \nseven\nyears\nago \nour \nfath\\\ners \nbrou\\\nght \nforth\non t\\\nhis \ncont\\\ninent\na new\nnati\\\non, \nconc\\\neived\nin l\\\niber\\\nty a\\\nnd d\\\nedic\\\nated \nto t\\\nhe p\\\nropo\\\nsiti\\\non t\\\nhat \nall \nmen \nare \ncrea\\\nted \nequa\\\nl. N\\\now we\nare \nenga\\\nged \nin a \ngreat\ncivil\nwar, \ntest\\\ning \nwhet\\\nher \nthat \nnati\\\non or\nany \nnati\\\non so\nconc\\\neived\nand \nso d\\\nedic\\\nated \ncan \nlong \nendu\\\nre. \nWe a\\\nre m\\\net on\na gr\\\neat \nbatt\\\nlefi\\\neld \nof t\\\nhat \nwar. \nWe h\\\nave \ncome \nto d\\\nedic\\\nate a\nport\\\nion \nof t\\\nhat \nfield\nas a \nfinal\nrest\\\ning-\\\nplace\nfor \nthose\nwho \nhere \ngave \ntheir\nlives\nthat \nthat \nnati\\\non m\\\night \nlive.\nIt is\nalto\\\ngeth\\\ner f\\\nitti\\\nng a\\\nnd p\\\nroper\nthat \nwe s\\\nhould\ndo t\\\nhis. \nBut \nin a \nlarg\\\ner s\\\nense,\nwe c\\\nannot\ndedi\\\ncate,\nwe c\\\nannot\ncons\\\necra\\\nte, \nwe c\\\nannot\nhall\\\now t\\\nhis \ngrou\\\nnd. \nThe \nbrave\nmen, \nlivi\\\nng a\\\nnd d\\\nead \nwho \nstru\\\nggled\nhere \nhave \ncons\\\necra\\\nted \nit f\\\nar a\\\nbove \nour \npoor \npower\nto a\\\ndd or\ndetr\\\nact. \nThe \nworld\nwill \nlitt\\\nle n\\\note \nnor \nlong \nreme\\\nmber \nwhat \nwe s\\\nay h\\\nere, \nbut \nit c\\\nan n\\\never \nforg\\\net w\\\nhat \nthey \ndid \nhere.\nIt is\nfor \nus t\\\nhe l\\\niving\nrath\\\ner to\nbe d\\\nedic\\\nated \nhere \nto t\\\nhe u\\\nnfin\\\nished\nwork \nwhich\nthey \nwho \nfoug\\\nht h\\\nere \nhave \nthus \nfar \nso n\\\nobly \nadva\\\nnced.\nIt is\nrath\\\ner f\\\nor us\nto be\nhere \ndedi\\\ncated\nto t\\\nhe g\\\nreat \ntask \nrema\\\nining\nbefo\\\nre u\\\ns--t\\\nhat \nfrom \nthese\nhono\\\nred \ndead \nwe t\\\nake \nincr\\\neased\ndevo\\\ntion \nto t\\\nhat \ncause\nfor \nwhich\nthey \ngave \nthe \nlast \nfull \nmeas\\\nure \nof d\\\nevot\\\nion-\\\n-that\nwe h\\\nere \nhigh\\\nly r\\\nesol\\\nve t\\\nhat \nthese\ndead \nshall\nnot \nhave \ndied \nin v\\\nain, \nthat \nthis \nnati\\\non u\\\nnder \nGod \nshall\nhave \na new\nbirth\nof f\\\nreed\\\nom, \nand \nthat \ngove\\\nrnme\\\nnt of\nthe \npeop\\\nle, \nby t\\\nhe p\\\neopl\\\ne, f\\\nor t\\\nhe p\\\neople\nshall\nnot \nperi\\\nsh f\\\nrom \nthe \neart\\\nh. --\nPres.\nAbra\\\nham \nLinc\\\noln, \n19 N\\\novem\\\nber \n1863 \n"
-
- # Tests both abbreviations and abbreviations=
- def test_abbreviations
- abbr = [" Pres. Abraham Lincoln\n", " Pres. Abraham Lincoln\n"]
- assert_nothing_raised { @format_o = Text::Format.new }
- assert_equal([], @format_o.abbreviations)
- assert_nothing_raised { @format_o.abbreviations = [ 'foo', 'bar' ] }
- assert_equal([ 'foo', 'bar' ], @format_o.abbreviations)
- assert_equal(abbr[0], @format_o.format(abbr[0]))
- assert_nothing_raised { @format_o.extra_space = true }
- assert_equal(abbr[1], @format_o.format(abbr[0]))
- assert_nothing_raised { @format_o.abbreviations = [ "Pres" ] }
- assert_equal([ "Pres" ], @format_o.abbreviations)
- assert_equal(abbr[0], @format_o.format(abbr[0]))
- assert_nothing_raised { @format_o.extra_space = false }
- assert_equal(abbr[0], @format_o.format(abbr[0]))
- end
-
- # Tests both body_indent and body_indent=
- def test_body_indent
- assert_nothing_raised { @format_o = Text::Format.new }
- assert_equal(0, @format_o.body_indent)
- assert_nothing_raised { @format_o.body_indent = 7 }
- assert_equal(7, @format_o.body_indent)
- assert_nothing_raised { @format_o.body_indent = -3 }
- assert_equal(3, @format_o.body_indent)
- assert_nothing_raised { @format_o.body_indent = "9" }
- assert_equal(9, @format_o.body_indent)
- assert_nothing_raised { @format_o.body_indent = "-2" }
- assert_equal(2, @format_o.body_indent)
- assert_match(/^ [^ ]/, @format_o.format(GETTYSBURG).split("\n")[1])
- end
-
- # Tests both columns and columns=
- def test_columns
- assert_nothing_raised { @format_o = Text::Format.new }
- assert_equal(72, @format_o.columns)
- assert_nothing_raised { @format_o.columns = 7 }
- assert_equal(7, @format_o.columns)
- assert_nothing_raised { @format_o.columns = -3 }
- assert_equal(3, @format_o.columns)
- assert_nothing_raised { @format_o.columns = "9" }
- assert_equal(9, @format_o.columns)
- assert_nothing_raised { @format_o.columns = "-2" }
- assert_equal(2, @format_o.columns)
- assert_nothing_raised { @format_o.columns = 40 }
- assert_equal(40, @format_o.columns)
- assert_match(/this continent$/,
- @format_o.format(GETTYSBURG).split("\n")[1])
- end
-
- # Tests both extra_space and extra_space=
- def test_extra_space
- assert_nothing_raised { @format_o = Text::Format.new }
- assert(!@format_o.extra_space)
- assert_nothing_raised { @format_o.extra_space = true }
- assert(@format_o.extra_space)
- # The behaviour of extra_space is tested in test_abbreviations. There
- # is no need to reproduce it here.
- end
-
- # Tests both first_indent and first_indent=
- def test_first_indent
- assert_nothing_raised { @format_o = Text::Format.new }
- assert_equal(4, @format_o.first_indent)
- assert_nothing_raised { @format_o.first_indent = 7 }
- assert_equal(7, @format_o.first_indent)
- assert_nothing_raised { @format_o.first_indent = -3 }
- assert_equal(3, @format_o.first_indent)
- assert_nothing_raised { @format_o.first_indent = "9" }
- assert_equal(9, @format_o.first_indent)
- assert_nothing_raised { @format_o.first_indent = "-2" }
- assert_equal(2, @format_o.first_indent)
- assert_match(/^ [^ ]/, @format_o.format(GETTYSBURG).split("\n")[0])
- end
-
- def test_format_style
- assert_nothing_raised { @format_o = Text::Format.new }
- assert_equal(Text::Format::LEFT_ALIGN, @format_o.format_style)
- assert_match(/^November 1863$/,
- @format_o.format(GETTYSBURG).split("\n")[-1])
- assert_nothing_raised {
- @format_o.format_style = Text::Format::RIGHT_ALIGN
- }
- assert_equal(Text::Format::RIGHT_ALIGN, @format_o.format_style)
- assert_match(/^ +November 1863$/,
- @format_o.format(GETTYSBURG).split("\n")[-1])
- assert_nothing_raised {
- @format_o.format_style = Text::Format::RIGHT_FILL
- }
- assert_equal(Text::Format::RIGHT_FILL, @format_o.format_style)
- assert_match(/^November 1863 +$/,
- @format_o.format(GETTYSBURG).split("\n")[-1])
- assert_nothing_raised { @format_o.format_style = Text::Format::JUSTIFY }
- assert_equal(Text::Format::JUSTIFY, @format_o.format_style)
- assert_match(/^of freedom, and that government of the people, by the people, for the$/,
- @format_o.format(GETTYSBURG).split("\n")[-3])
- assert_raise(ArgumentError) { @format_o.format_style = 33 }
- end
-
- def test_tag_paragraph
- assert_nothing_raised { @format_o = Text::Format.new }
- assert(!@format_o.tag_paragraph)
- assert_nothing_raised { @format_o.tag_paragraph = true }
- assert(@format_o.tag_paragraph)
- assert_not_equal(@format_o.paragraphs([GETTYSBURG, GETTYSBURG]),
- Text::Format.new.paragraphs([GETTYSBURG, GETTYSBURG]))
- end
-
- def test_tag_text
- assert_nothing_raised { @format_o = Text::Format.new }
- assert_equal([], @format_o.tag_text)
- assert_equal(@format_o.format(GETTYSBURG),
- Text::Format.new.format(GETTYSBURG))
- assert_nothing_raised {
- @format_o.tag_paragraph = true
- @format_o.tag_text = ["Gettysburg Address", "---"]
- }
- assert_not_equal(@format_o.format(GETTYSBURG),
- Text::Format.new.format(GETTYSBURG))
- assert_not_equal(@format_o.paragraphs([GETTYSBURG, GETTYSBURG]),
- Text::Format.new.paragraphs([GETTYSBURG, GETTYSBURG]))
- assert_not_equal(@format_o.paragraphs([GETTYSBURG, GETTYSBURG,
- GETTYSBURG]),
- Text::Format.new.paragraphs([GETTYSBURG, GETTYSBURG,
- GETTYSBURG]))
- end
-
- def test_justify?
- assert_nothing_raised { @format_o = Text::Format.new }
- assert(!@format_o.justify?)
- assert_nothing_raised {
- @format_o.format_style = Text::Format::RIGHT_ALIGN
- }
- assert(!@format_o.justify?)
- assert_nothing_raised {
- @format_o.format_style = Text::Format::RIGHT_FILL
- }
- assert(!@format_o.justify?)
- assert_nothing_raised {
- @format_o.format_style = Text::Format::JUSTIFY
- }
- assert(@format_o.justify?)
- # The format testing is done in test_format_style
- end
-
- def test_left_align?
- assert_nothing_raised { @format_o = Text::Format.new }
- assert(@format_o.left_align?)
- assert_nothing_raised {
- @format_o.format_style = Text::Format::RIGHT_ALIGN
- }
- assert(!@format_o.left_align?)
- assert_nothing_raised {
- @format_o.format_style = Text::Format::RIGHT_FILL
- }
- assert(!@format_o.left_align?)
- assert_nothing_raised { @format_o.format_style = Text::Format::JUSTIFY }
- assert(!@format_o.left_align?)
- # The format testing is done in test_format_style
- end
-
- def test_left_margin
- assert_nothing_raised { @format_o = Text::Format.new }
- assert_equal(0, @format_o.left_margin)
- assert_nothing_raised { @format_o.left_margin = -3 }
- assert_equal(3, @format_o.left_margin)
- assert_nothing_raised { @format_o.left_margin = "9" }
- assert_equal(9, @format_o.left_margin)
- assert_nothing_raised { @format_o.left_margin = "-2" }
- assert_equal(2, @format_o.left_margin)
- assert_nothing_raised { @format_o.left_margin = 7 }
- assert_equal(7, @format_o.left_margin)
- assert_nothing_raised {
- ft = @format_o.format(GETTYSBURG).split("\n")
- assert_match(/^ {11}Four score/, ft[0])
- assert_match(/^ {7}November/, ft[-1])
- }
- end
-
- def test_hard_margins
- assert_nothing_raised { @format_o = Text::Format.new }
- assert(!@format_o.hard_margins)
- assert_nothing_raised {
- @format_o.hard_margins = true
- @format_o.columns = 5
- @format_o.first_indent = 0
- @format_o.format_style = Text::Format::RIGHT_FILL
- }
- assert(@format_o.hard_margins)
- assert_equal(FIVE_COL, @format_o.format(GETTYSBURG))
- assert_nothing_raised {
- @format_o.split_rules |= Text::Format::SPLIT_CONTINUATION
- assert_equal(Text::Format::SPLIT_CONTINUATION_FIXED,
- @format_o.split_rules)
- }
- assert_equal(FIVE_CNT, @format_o.format(GETTYSBURG))
- end
-
- # Tests both nobreak and nobreak_regex, since one is only useful
- # with the other.
- def test_nobreak
- assert_nothing_raised { @format_o = Text::Format.new }
- assert(!@format_o.nobreak)
- assert(@format_o.nobreak_regex.empty?)
- assert_nothing_raised {
- @format_o.nobreak = true
- @format_o.nobreak_regex = { '^this$' => '^continent$' }
- @format_o.columns = 77
- }
- assert(@format_o.nobreak)
- assert_equal({ '^this$' => '^continent$' }, @format_o.nobreak_regex)
- assert_match(/^this continent/,
- @format_o.format(GETTYSBURG).split("\n")[1])
- end
-
- def test_right_align?
- assert_nothing_raised { @format_o = Text::Format.new }
- assert(!@format_o.right_align?)
- assert_nothing_raised {
- @format_o.format_style = Text::Format::RIGHT_ALIGN
- }
- assert(@format_o.right_align?)
- assert_nothing_raised {
- @format_o.format_style = Text::Format::RIGHT_FILL
- }
- assert(!@format_o.right_align?)
- assert_nothing_raised { @format_o.format_style = Text::Format::JUSTIFY }
- assert(!@format_o.right_align?)
- # The format testing is done in test_format_style
- end
-
- def test_right_fill?
- assert_nothing_raised { @format_o = Text::Format.new }
- assert(!@format_o.right_fill?)
- assert_nothing_raised {
- @format_o.format_style = Text::Format::RIGHT_ALIGN
- }
- assert(!@format_o.right_fill?)
- assert_nothing_raised {
- @format_o.format_style = Text::Format::RIGHT_FILL
- }
- assert(@format_o.right_fill?)
- assert_nothing_raised {
- @format_o.format_style = Text::Format::JUSTIFY
- }
- assert(!@format_o.right_fill?)
- # The format testing is done in test_format_style
- end
-
- def test_right_margin
- assert_nothing_raised { @format_o = Text::Format.new }
- assert_equal(0, @format_o.right_margin)
- assert_nothing_raised { @format_o.right_margin = -3 }
- assert_equal(3, @format_o.right_margin)
- assert_nothing_raised { @format_o.right_margin = "9" }
- assert_equal(9, @format_o.right_margin)
- assert_nothing_raised { @format_o.right_margin = "-2" }
- assert_equal(2, @format_o.right_margin)
- assert_nothing_raised { @format_o.right_margin = 7 }
- assert_equal(7, @format_o.right_margin)
- assert_nothing_raised {
- ft = @format_o.format(GETTYSBURG).split("\n")
- assert_match(/^ {4}Four score.*forth on$/, ft[0])
- assert_match(/^November/, ft[-1])
- }
- end
-
- def test_tabstop
- assert_nothing_raised { @format_o = Text::Format.new }
- assert_equal(8, @format_o.tabstop)
- assert_nothing_raised { @format_o.tabstop = 7 }
- assert_equal(7, @format_o.tabstop)
- assert_nothing_raised { @format_o.tabstop = -3 }
- assert_equal(3, @format_o.tabstop)
- assert_nothing_raised { @format_o.tabstop = "9" }
- assert_equal(9, @format_o.tabstop)
- assert_nothing_raised { @format_o.tabstop = "-2" }
- assert_equal(2, @format_o.tabstop)
- end
-
- def test_text
- assert_nothing_raised { @format_o = Text::Format.new }
- assert_equal([], @format_o.text)
- assert_nothing_raised { @format_o.text = "Test Text" }
- assert_equal("Test Text", @format_o.text)
- assert_nothing_raised { @format_o.text = ["Line 1", "Line 2"] }
- assert_equal(["Line 1", "Line 2"], @format_o.text)
- end
-
- def test_s_new
- # new(NilClass) { block }
- assert_nothing_raised do
- @format_o = Text::Format.new {
- self.text = "Test 1, 2, 3"
- }
- end
- assert_equal("Test 1, 2, 3", @format_o.text)
-
- # new(Hash Symbols)
- assert_nothing_raised { @format_o = Text::Format.new(:columns => 72) }
- assert_equal(72, @format_o.columns)
-
- # new(Hash String)
- assert_nothing_raised { @format_o = Text::Format.new('columns' => 72) }
- assert_equal(72, @format_o.columns)
-
- # new(Hash) { block }
- assert_nothing_raised do
- @format_o = Text::Format.new('columns' => 80) {
- self.text = "Test 4, 5, 6"
- }
- end
- assert_equal("Test 4, 5, 6", @format_o.text)
- assert_equal(80, @format_o.columns)
-
- # new(Text::Format)
- assert_nothing_raised do
- fo = Text::Format.new(@format_o)
- assert(fo == @format_o)
- end
-
- # new(Text::Format) { block }
- assert_nothing_raised do
- fo = Text::Format.new(@format_o) { self.columns = 79 }
- assert(fo != @format_o)
- end
-
- # new(String)
- assert_nothing_raised { @format_o = Text::Format.new("Test A, B, C") }
- assert_equal("Test A, B, C", @format_o.text)
-
- # new(String) { block }
- assert_nothing_raised do
- @format_o = Text::Format.new("Test X, Y, Z") { self.columns = -5 }
- end
- assert_equal("Test X, Y, Z", @format_o.text)
- assert_equal(5, @format_o.columns)
- end
-
- def test_center
- assert_nothing_raised { @format_o = Text::Format.new }
- assert_nothing_raised do
- ct = @format_o.center(GETTYSBURG.split("\n")).split("\n")
- assert_match(/^ Four score and seven years ago our fathers brought forth on this/, ct[0])
- assert_match(/^ not perish from the earth./, ct[-3])
- end
- end
-
- def test_expand
- assert_nothing_raised { @format_o = Text::Format.new }
- assert_equal(" ", @format_o.expand("\t "))
- assert_nothing_raised { @format_o.tabstop = 4 }
- assert_equal(" ", @format_o.expand("\t "))
- end
-
- def test_unexpand
- assert_nothing_raised { @format_o = Text::Format.new }
- assert_equal("\t ", @format_o.unexpand(" "))
- assert_nothing_raised { @format_o.tabstop = 4 }
- assert_equal("\t ", @format_o.unexpand(" "))
- end
-
- def test_space_only
- assert_equal("", Text::Format.new.format(" "))
- assert_equal("", Text::Format.new.format("\n"))
- assert_equal("", Text::Format.new.format(" "))
- assert_equal("", Text::Format.new.format(" \n"))
- assert_equal("", Text::Format.new.paragraphs("\n"))
- assert_equal("", Text::Format.new.paragraphs(" "))
- assert_equal("", Text::Format.new.paragraphs(" "))
- assert_equal("", Text::Format.new.paragraphs(" \n"))
- assert_equal("", Text::Format.new.paragraphs(["\n"]))
- assert_equal("", Text::Format.new.paragraphs([" "]))
- assert_equal("", Text::Format.new.paragraphs([" "]))
- assert_equal("", Text::Format.new.paragraphs([" \n"]))
- end
-
- def test_splendiferous
- h = nil
- test = "This is a splendiferous test"
- assert_nothing_raised { @format_o = Text::Format.new(:columns => 6, :left_margin => 0, :indent => 0, :first_indent => 0) }
- assert_match(/^splendiferous$/, @format_o.format(test))
- assert_nothing_raised { @format_o.hard_margins = true }
- assert_match(/^lendif$/, @format_o.format(test))
- assert_nothing_raised { h = Object.new }
- assert_nothing_raised do
- @format_o.split_rules = Text::Format::SPLIT_HYPHENATION
- class << h #:nodoc:
- def hyphenate_to(word, size)
- return ["", word] if size < 2
- [word[0 ... size], word[size .. -1]]
- end
- end
- @format_o.hyphenator = h
- end
- assert_match(/^iferou$/, @format_o.format(test))
- assert_nothing_raised { h = Object.new }
- assert_nothing_raised do
- class << h #:nodoc:
- def hyphenate_to(word, size, formatter)
- return ["", word] if word.size < formatter.columns
- [word[0 ... size], word[size .. -1]]
- end
- end
- @format_o.hyphenator = h
- end
- assert_match(/^ferous$/, @format_o.format(test))
- end
- end
-end
diff --git a/vendor/rails/actionmailer/lib/action_mailer/vendor/text_format.rb b/vendor/rails/actionmailer/lib/action_mailer/vendor/text_format.rb
deleted file mode 100644
index c6c8c394..00000000
--- a/vendor/rails/actionmailer/lib/action_mailer/vendor/text_format.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# Prefer gems to the bundled libs.
-require 'rubygems'
-
-begin
- gem 'text-format', '>= 0.6.3'
-rescue Gem::LoadError
- $:.unshift "#{File.dirname(__FILE__)}/text-format-0.6.3"
-end
-
-require 'text/format'
diff --git a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail.rb b/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail.rb
deleted file mode 100644
index 79d9fa82..00000000
--- a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-require 'tmail/version'
-require 'tmail/mail'
-require 'tmail/mailbox'
-require 'tmail/core_extensions'
-require 'tmail/net'
-require 'tmail/vendor/rchardet-1.3/lib/rchardet'
\ No newline at end of file
diff --git a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/Makefile b/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/Makefile
deleted file mode 100644
index 8688b7fc..00000000
--- a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/Makefile
+++ /dev/null
@@ -1,18 +0,0 @@
-# lib/tmail/Makefile
-#
-
-debug:
- rm -f parser.rb
- make parser.rb DEBUG=true
-
-parser.rb: parser.y
- if [ "$(DEBUG)" = true ]; then \
- racc -v -g -o$@ parser.y ;\
- else \
- racc -E -o$@ parser.y ;\
- fi
-
-clean:
- rm -f parser.rb parser.output
-
-distclean: clean
diff --git a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/address.rb b/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/address.rb
deleted file mode 100644
index d506eaf4..00000000
--- a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/address.rb
+++ /dev/null
@@ -1,392 +0,0 @@
-=begin rdoc
-
-= Address handling class
-
-=end
-#--
-# Copyright (c) 1998-2003 Minero Aoki
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-# Note: Originally licensed under LGPL v2+. Using MIT license for Rails
-# with permission of Minero Aoki.
-#++
-
-require 'tmail/encode'
-require 'tmail/parser'
-
-
-module TMail
-
- # = Class Address
- #
- # Provides a complete handling library for email addresses. Can parse a string of an
- # address directly or take in preformatted addresses themselves. Allows you to add
- # and remove phrases from the front of the address and provides a compare function for
- # email addresses.
- #
- # == Parsing and Handling a Valid Address:
- #
- # Just pass the email address in as a string to Address.parse:
- #
- # email = TMail::Address.parse('Mikel Lindsaar ')
- # #=> #
- # email.address
- # #=> "mikel@lindsaar.net"
- # email.local
- # #=> "mikel"
- # email.domain
- # #=> "lindsaar.net"
- # email.name # Aliased as phrase as well
- # #=> "Mikel Lindsaar"
- #
- # == Detecting an Invalid Address
- #
- # If you want to check the syntactical validity of an email address, just pass it to
- # Address.parse and catch any SyntaxError:
- #
- # begin
- # TMail::Address.parse("mikel 2@@@@@ me .com")
- # rescue TMail::SyntaxError
- # puts("Invalid Email Address Detected")
- # else
- # puts("Address is valid")
- # end
- # #=> "Invalid Email Address Detected"
- class Address
-
- include TextUtils #:nodoc:
-
- # Sometimes you need to parse an address, TMail can do it for you and provide you with
- # a fairly robust method of detecting a valid address.
- #
- # Takes in a string, returns a TMail::Address object.
- #
- # Raises a TMail::SyntaxError on invalid email format
- def Address.parse( str )
- Parser.parse :ADDRESS, str
- end
-
- def address_group? #:nodoc:
- false
- end
-
- # Address.new(local, domain)
- #
- # Accepts:
- #
- # * local - Left of the at symbol
- #
- # * domain - Array of the domain split at the periods.
- #
- # For example:
- #
- # Address.new("mikel", ["lindsaar", "net"])
- # #=> "#"
- def initialize( local, domain )
- if domain
- domain.each do |s|
- raise SyntaxError, 'empty word in domain' if s.empty?
- end
- end
-
- # This is to catch an unquoted "@" symbol in the local part of the
- # address. Handles addresses like <"@"@me.com> and makes sure they
- # stay like <"@"@me.com> (previously were becoming <@@me.com>)
- if local && (local.join == '@' || local.join =~ /\A[^"].*?@.*?[^"]\Z/)
- @local = "\"#{local.join}\""
- else
- @local = local
- end
-
- @domain = domain
- @name = nil
- @routes = []
- end
-
- # Provides the name or 'phrase' of the email address.
- #
- # For Example:
- #
- # email = TMail::Address.parse("Mikel Lindsaar ")
- # email.name
- # #=> "Mikel Lindsaar"
- def name
- @name
- end
-
- # Setter method for the name or phrase of the email
- #
- # For Example:
- #
- # email = TMail::Address.parse("mikel@lindsaar.net")
- # email.name
- # #=> nil
- # email.name = "Mikel Lindsaar"
- # email.to_s
- # #=> "Mikel Lindsaar "
- def name=( str )
- @name = str
- @name = nil if str and str.empty?
- end
-
- #:stopdoc:
- alias phrase name
- alias phrase= name=
- #:startdoc:
-
- # This is still here from RFC 822, and is now obsolete per RFC2822 Section 4.
- #
- # "When interpreting addresses, the route portion SHOULD be ignored."
- #
- # It is still here, so you can access it.
- #
- # Routes return the route portion at the front of the email address, if any.
- #
- # For Example:
- # email = TMail::Address.parse( "<@sa,@another:Mikel@me.com>")
- # => #
- # email.to_s
- # => "<@sa,@another:Mikel@me.com>"
- # email.routes
- # => ["sa", "another"]
- def routes
- @routes
- end
-
- def inspect #:nodoc:
- "#<#{self.class} #{address()}>"
- end
-
- # Returns the local part of the email address
- #
- # For Example:
- #
- # email = TMail::Address.parse("mikel@lindsaar.net")
- # email.local
- # #=> "mikel"
- def local
- return nil unless @local
- return '""' if @local.size == 1 and @local[0].empty?
- # Check to see if it is an array before trying to map it
- if @local.respond_to?(:map)
- @local.map {|i| quote_atom(i) }.join('.')
- else
- quote_atom(@local)
- end
- end
-
- # Returns the domain part of the email address
- #
- # For Example:
- #
- # email = TMail::Address.parse("mikel@lindsaar.net")
- # email.local
- # #=> "lindsaar.net"
- def domain
- return nil unless @domain
- join_domain(@domain)
- end
-
- # Returns the full specific address itself
- #
- # For Example:
- #
- # email = TMail::Address.parse("mikel@lindsaar.net")
- # email.address
- # #=> "mikel@lindsaar.net"
- def spec
- s = self.local
- d = self.domain
- if s and d
- s + '@' + d
- else
- s
- end
- end
-
- alias address spec
-
- # Provides == function to the email. Only checks the actual address
- # and ignores the name/phrase component
- #
- # For Example
- #
- # addr1 = TMail::Address.parse("My Address ")
- # #=> "#"
- # addr2 = TMail::Address.parse("Another ")
- # #=> "#"
- # addr1 == addr2
- # #=> true
- def ==( other )
- other.respond_to? :spec and self.spec == other.spec
- end
-
- alias eql? ==
-
- # Provides a unique hash value for this record against the local and domain
- # parts, ignores the name/phrase value
- #
- # email = TMail::Address.parse("mikel@lindsaar.net")
- # email.hash
- # #=> 18767598
- def hash
- @local.hash ^ @domain.hash
- end
-
- # Duplicates a TMail::Address object returning the duplicate
- #
- # addr1 = TMail::Address.parse("mikel@lindsaar.net")
- # addr2 = addr1.dup
- # addr1.id == addr2.id
- # #=> false
- def dup
- obj = self.class.new(@local.dup, @domain.dup)
- obj.name = @name.dup if @name
- obj.routes.replace @routes
- obj
- end
-
- include StrategyInterface #:nodoc:
-
- def accept( strategy, dummy1 = nil, dummy2 = nil ) #:nodoc:
- unless @local
- strategy.meta '<>' # empty return-path
- return
- end
-
- spec_p = (not @name and @routes.empty?)
- if @name
- strategy.phrase @name
- strategy.space
- end
- tmp = spec_p ? '' : '<'
- unless @routes.empty?
- tmp << @routes.map {|i| '@' + i }.join(',') << ':'
- end
- tmp << self.spec
- tmp << '>' unless spec_p
- strategy.meta tmp
- strategy.lwsp ''
- end
-
- end
-
-
- class AddressGroup
-
- include Enumerable
-
- def address_group?
- true
- end
-
- def initialize( name, addrs )
- @name = name
- @addresses = addrs
- end
-
- attr_reader :name
-
- def ==( other )
- other.respond_to? :to_a and @addresses == other.to_a
- end
-
- alias eql? ==
-
- def hash
- map {|i| i.hash }.hash
- end
-
- def []( idx )
- @addresses[idx]
- end
-
- def size
- @addresses.size
- end
-
- def empty?
- @addresses.empty?
- end
-
- def each( &block )
- @addresses.each(&block)
- end
-
- def to_a
- @addresses.dup
- end
-
- alias to_ary to_a
-
- def include?( a )
- @addresses.include? a
- end
-
- def flatten
- set = []
- @addresses.each do |a|
- if a.respond_to? :flatten
- set.concat a.flatten
- else
- set.push a
- end
- end
- set
- end
-
- def each_address( &block )
- flatten.each(&block)
- end
-
- def add( a )
- @addresses.push a
- end
-
- alias push add
-
- def delete( a )
- @addresses.delete a
- end
-
- include StrategyInterface
-
- def accept( strategy, dummy1 = nil, dummy2 = nil )
- strategy.phrase @name
- strategy.meta ':'
- strategy.space
- first = true
- each do |mbox|
- if first
- first = false
- else
- strategy.puts_meta ','
- end
- strategy.space
- mbox.accept strategy
- end
- strategy.meta ';'
- strategy.lwsp ''
- end
-
- end
-
-end # module TMail
diff --git a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/attachments.rb b/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/attachments.rb
deleted file mode 100644
index 19ce1aa8..00000000
--- a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/attachments.rb
+++ /dev/null
@@ -1,65 +0,0 @@
-=begin rdoc
-
-= Attachment handling file
-
-=end
-
-require 'kconv'
-require 'stringio'
-
-module TMail
- class Attachment < StringIO
- attr_accessor :original_filename, :content_type
- alias quoted_filename original_filename
- end
-
- class Mail
- def has_attachments?
- attachment?(self) || multipart? && parts.any? { |part| attachment?(part) }
- end
-
- # Returns true if this part's content main type is text, else returns false.
- # By main type is meant "text/plain" is text. "text/html" is text
- def text_content_type?
- self.header['content-type'] && (self.header['content-type'].main_type == 'text')
- end
-
- def inline_attachment?(part)
- part['content-id'] || (part['content-disposition'] && part['content-disposition'].disposition == 'inline' && !part.text_content_type?)
- end
-
- def attachment?(part)
- part.disposition_is_attachment? || (!part.content_type.nil? && !part.text_content_type?) unless part.multipart?
- end
-
- def attachments
- if multipart?
- parts.collect { |part| attachment(part) }.flatten.compact
- elsif attachment?(self)
- [attachment(self)]
- end
- end
-
- private
-
- def attachment(part)
- if part.multipart?
- part.attachments
- elsif attachment?(part)
- content = part.body # unquoted automatically by TMail#body
- file_name = (part['content-location'] && part['content-location'].body) ||
- part.sub_header('content-type', 'name') ||
- part.sub_header('content-disposition', 'filename') ||
- 'noname'
-
- return if content.blank?
-
- attachment = TMail::Attachment.new(content)
- attachment.original_filename = file_name.strip unless file_name.blank?
- attachment.content_type = part.content_type
- attachment
- end
- end
-
- end
-end
diff --git a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/base64.rb b/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/base64.rb
deleted file mode 100644
index e294c629..00000000
--- a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/base64.rb
+++ /dev/null
@@ -1,46 +0,0 @@
-#--
-# Copyright (c) 1998-2003 Minero Aoki
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-# Note: Originally licensed under LGPL v2+. Using MIT license for Rails
-# with permission of Minero Aoki.
-#++
-#:stopdoc:
-module TMail
- module Base64
-
- module_function
-
- def folding_encode( str, eol = "\n", limit = 60 )
- [str].pack('m')
- end
-
- def encode( str )
- [str].pack('m').tr( "\r\n", '' )
- end
-
- def decode( str, strict = false )
- str.unpack('m').first
- end
-
- end
-end
-#:startdoc:
diff --git a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/compat.rb b/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/compat.rb
deleted file mode 100644
index 1275df79..00000000
--- a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/compat.rb
+++ /dev/null
@@ -1,41 +0,0 @@
-#:stopdoc:
-unless Enumerable.method_defined?(:map)
- module Enumerable #:nodoc:
- alias map collect
- end
-end
-
-unless Enumerable.method_defined?(:select)
- module Enumerable #:nodoc:
- alias select find_all
- end
-end
-
-unless Enumerable.method_defined?(:reject)
- module Enumerable #:nodoc:
- def reject
- result = []
- each do |i|
- result.push i unless yield(i)
- end
- result
- end
- end
-end
-
-unless Enumerable.method_defined?(:sort_by)
- module Enumerable #:nodoc:
- def sort_by
- map {|i| [yield(i), i] }.sort.map {|val, i| i }
- end
- end
-end
-
-unless File.respond_to?(:read)
- def File.read(fname) #:nodoc:
- File.open(fname) {|f|
- return f.read
- }
- end
-end
-#:startdoc:
\ No newline at end of file
diff --git a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/config.rb b/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/config.rb
deleted file mode 100644
index 3a876dcd..00000000
--- a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/config.rb
+++ /dev/null
@@ -1,67 +0,0 @@
-#--
-# Copyright (c) 1998-2003 Minero Aoki
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-# Note: Originally licensed under LGPL v2+. Using MIT license for Rails
-# with permission of Minero Aoki.
-#++
-#:stopdoc:
-module TMail
-
- class Config
-
- def initialize( strict )
- @strict_parse = strict
- @strict_base64decode = strict
- end
-
- def strict_parse?
- @strict_parse
- end
-
- attr_writer :strict_parse
-
- def strict_base64decode?
- @strict_base64decode
- end
-
- attr_writer :strict_base64decode
-
- def new_body_port( mail )
- StringPort.new
- end
-
- alias new_preamble_port new_body_port
- alias new_part_port new_body_port
-
- end
-
- DEFAULT_CONFIG = Config.new(false)
- DEFAULT_STRICT_CONFIG = Config.new(true)
-
- def Config.to_config( arg )
- return DEFAULT_STRICT_CONFIG if arg == true
- return DEFAULT_CONFIG if arg == false
- arg or DEFAULT_CONFIG
- end
-
-end
-#:startdoc:
\ No newline at end of file
diff --git a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/core_extensions.rb b/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/core_extensions.rb
deleted file mode 100644
index da62c33b..00000000
--- a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/core_extensions.rb
+++ /dev/null
@@ -1,63 +0,0 @@
-#:stopdoc:
-unless Object.respond_to?(:blank?)
- class Object
- # Check first to see if we are in a Rails environment, no need to
- # define these methods if we are
-
- # An object is blank if it's nil, empty, or a whitespace string.
- # For example, "", " ", nil, [], and {} are blank.
- #
- # This simplifies
- # if !address.nil? && !address.empty?
- # to
- # if !address.blank?
- def blank?
- if respond_to?(:empty?) && respond_to?(:strip)
- empty? or strip.empty?
- elsif respond_to?(:empty?)
- empty?
- else
- !self
- end
- end
- end
-
- class NilClass
- def blank?
- true
- end
- end
-
- class FalseClass
- def blank?
- true
- end
- end
-
- class TrueClass
- def blank?
- false
- end
- end
-
- class Array
- alias_method :blank?, :empty?
- end
-
- class Hash
- alias_method :blank?, :empty?
- end
-
- class String
- def blank?
- empty? || strip.empty?
- end
- end
-
- class Numeric
- def blank?
- false
- end
- end
-end
-#:startdoc:
\ No newline at end of file
diff --git a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/encode.rb b/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/encode.rb
deleted file mode 100644
index af66dfac..00000000
--- a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/encode.rb
+++ /dev/null
@@ -1,590 +0,0 @@
-#--
-# = COPYRIGHT:
-#
-# Copyright (c) 1998-2003 Minero Aoki
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-# Note: Originally licensed under LGPL v2+. Using MIT license for Rails
-# with permission of Minero Aoki.
-#++
-#:stopdoc:
-require 'nkf'
-require 'tmail/base64'
-require 'tmail/stringio'
-require 'tmail/utils'
-#:startdoc:
-
-
-module TMail
-
- #:stopdoc:
- class << self
- attr_accessor :KCODE
- end
- self.KCODE = 'NONE'
-
- module StrategyInterface
-
- def create_dest( obj )
- case obj
- when nil
- StringOutput.new
- when String
- StringOutput.new(obj)
- when IO, StringOutput
- obj
- else
- raise TypeError, 'cannot handle this type of object for dest'
- end
- end
- module_function :create_dest
-
- #:startdoc:
- # Returns the TMail object encoded and ready to be sent via SMTP etc.
- # You should call this before you are packaging up your email to
- # correctly escape all the values that need escaping in the email, line
- # wrap the email etc.
- #
- # It is also a good idea to call this before you marshal or serialize
- # a TMail object.
- #
- # For Example:
- #
- # email = TMail::Load(my_email_file)
- # email_to_send = email.encoded
- def encoded( eol = "\r\n", charset = 'j', dest = nil )
- accept_strategy Encoder, eol, charset, dest
- end
-
- # Returns the TMail object decoded and ready to be used by you, your
- # program etc.
- #
- # You should call this before you are packaging up your email to
- # correctly escape all the values that need escaping in the email, line
- # wrap the email etc.
- #
- # For Example:
- #
- # email = TMail::Load(my_email_file)
- # email_to_send = email.encoded
- def decoded( eol = "\n", charset = 'e', dest = nil )
- # Turn the E-Mail into a string and return it with all
- # encoded characters decoded. alias for to_s
- accept_strategy Decoder, eol, charset, dest
- end
-
- alias to_s decoded
-
- def accept_strategy( klass, eol, charset, dest = nil ) #:nodoc:
- dest ||= ''
- accept klass.new( create_dest(dest), charset, eol )
- dest
- end
-
- end
-
- #:stopdoc:
-
- ###
- ### MIME B encoding decoder
- ###
-
- class Decoder
-
- include TextUtils
-
- encoded = '=\?(?:iso-2022-jp|euc-jp|shift_jis)\?[QB]\?[a-z0-9+/=]+\?='
- ENCODED_WORDS = /#{encoded}(?:\s+#{encoded})*/i
- SPACER = "\t"
-
- OUTPUT_ENCODING = {
- 'EUC' => 'e',
- 'SJIS' => 's',
- }
-
- def self.decode( str, encoding = nil )
- encoding ||= (OUTPUT_ENCODING[TMail.KCODE] || 'j')
- opt = '-mS' + encoding
- str.gsub(ENCODED_WORDS) {|s| NKF.nkf(opt, s) }
- end
-
- def initialize( dest, encoding = nil, eol = "\n" )
- @f = StrategyInterface.create_dest(dest)
- @encoding = (/\A[ejs]/ === encoding) ? encoding[0,1] : nil
- @eol = eol
- end
-
- def decode( str )
- self.class.decode(str, @encoding)
- end
- private :decode
-
- def terminate
- end
-
- def header_line( str )
- @f << decode(str)
- end
-
- def header_name( nm )
- @f << nm << ': '
- end
-
- def header_body( str )
- @f << decode(str)
- end
-
- def space
- @f << ' '
- end
-
- alias spc space
-
- def lwsp( str )
- @f << str
- end
-
- def meta( str )
- @f << str
- end
-
- def puts_meta( str )
- @f << str
- end
-
- def text( str )
- @f << decode(str)
- end
-
- def phrase( str )
- @f << quote_phrase(decode(str))
- end
-
- def kv_pair( k, v )
- v = dquote(v) unless token_safe?(v)
- @f << k << '=' << v
- end
-
- def puts( str = nil )
- @f << str if str
- @f << @eol
- end
-
- def write( str )
- @f << str
- end
-
- end
-
-
- ###
- ### MIME B-encoding encoder
- ###
-
- #
- # FIXME: This class can handle only (euc-jp/shift_jis -> iso-2022-jp).
- #
- class Encoder
-
- include TextUtils
-
- BENCODE_DEBUG = false unless defined?(BENCODE_DEBUG)
-
- def Encoder.encode( str )
- e = new()
- e.header_body str
- e.terminate
- e.dest.string
- end
-
- SPACER = "\t"
- MAX_LINE_LEN = 78
- RFC_2822_MAX_LENGTH = 998
-
- OPTIONS = {
- 'EUC' => '-Ej -m0',
- 'SJIS' => '-Sj -m0',
- 'UTF8' => nil, # FIXME
- 'NONE' => nil
- }
-
- def initialize( dest = nil, encoding = nil, eol = "\r\n", limit = nil )
- @f = StrategyInterface.create_dest(dest)
- @opt = OPTIONS[TMail.KCODE]
- @eol = eol
- @folded = false
- @preserve_quotes = true
- reset
- end
-
- def preserve_quotes=( bool )
- @preserve_quotes
- end
-
- def preserve_quotes
- @preserve_quotes
- end
-
- def normalize_encoding( str )
- if @opt
- then NKF.nkf(@opt, str)
- else str
- end
- end
-
- def reset
- @text = ''
- @lwsp = ''
- @curlen = 0
- end
-
- def terminate
- add_lwsp ''
- reset
- end
-
- def dest
- @f
- end
-
- def puts( str = nil )
- @f << str if str
- @f << @eol
- end
-
- def write( str )
- @f << str
- end
-
- #
- # add
- #
-
- def header_line( line )
- scanadd line
- end
-
- def header_name( name )
- add_text name.split(/-/).map {|i| i.capitalize }.join('-')
- add_text ':'
- add_lwsp ' '
- end
-
- def header_body( str )
- scanadd normalize_encoding(str)
- end
-
- def space
- add_lwsp ' '
- end
-
- alias spc space
-
- def lwsp( str )
- add_lwsp str.sub(/[\r\n]+[^\r\n]*\z/, '')
- end
-
- def meta( str )
- add_text str
- end
-
- def puts_meta( str )
- add_text str + @eol + SPACER
- end
-
- def text( str )
- scanadd normalize_encoding(str)
- end
-
- def phrase( str )
- str = normalize_encoding(str)
- if CONTROL_CHAR === str
- scanadd str
- else
- add_text quote_phrase(str)
- end
- end
-
- # FIXME: implement line folding
- #
- def kv_pair( k, v )
- return if v.nil?
- v = normalize_encoding(v)
- if token_safe?(v)
- add_text k + '=' + v
- elsif not CONTROL_CHAR === v
- add_text k + '=' + quote_token(v)
- else
- # apply RFC2231 encoding
- kv = k + '*=' + "iso-2022-jp'ja'" + encode_value(v)
- add_text kv
- end
- end
-
- def encode_value( str )
- str.gsub(TOKEN_UNSAFE) {|s| '%%%02x' % s[0] }
- end
-
- private
-
- def scanadd( str, force = false )
- types = ''
- strs = []
- if str.respond_to?(:encoding)
- enc = str.encoding
- str.force_encoding(Encoding::ASCII_8BIT)
- end
- until str.empty?
- if m = /\A[^\e\t\r\n ]+/.match(str)
- types << (force ? 'j' : 'a')
- if str.respond_to?(:encoding)
- strs.push m[0].force_encoding(enc)
- else
- strs.push m[0]
- end
- elsif m = /\A[\t\r\n ]+/.match(str)
- types << 's'
- if str.respond_to?(:encoding)
- strs.push m[0].force_encoding(enc)
- else
- strs.push m[0]
- end
-
- elsif m = /\A\e../.match(str)
- esc = m[0]
- str = m.post_match
- if esc != "\e(B" and m = /\A[^\e]+/.match(str)
- types << 'j'
- if str.respond_to?(:encoding)
- strs.push m[0].force_encoding(enc)
- else
- strs.push m[0]
- end
- end
-
- else
- raise 'TMail FATAL: encoder scan fail'
- end
- (str = m.post_match) unless m.nil?
- end
-
- do_encode types, strs
- end
-
- def do_encode( types, strs )
- #
- # result : (A|E)(S(A|E))*
- # E : W(SW)*
- # W : (J|A)+ but must contain J # (J|A)*J(J|A)*
- # A : <>
- # J : <>
- # S : <>
- #
- # An encoding unit is `E'.
- # Input (parameter `types') is (J|A)(J|A|S)*(J|A)
- #
- if BENCODE_DEBUG
- puts
- puts '-- do_encode ------------'
- puts types.split(//).join(' ')
- p strs
- end
-
- e = /[ja]*j[ja]*(?:s[ja]*j[ja]*)*/
-
- while m = e.match(types)
- pre = m.pre_match
- concat_A_S pre, strs[0, pre.size] unless pre.empty?
- concat_E m[0], strs[m.begin(0) ... m.end(0)]
- types = m.post_match
- strs.slice! 0, m.end(0)
- end
- concat_A_S types, strs
- end
-
- def concat_A_S( types, strs )
- if RUBY_VERSION < '1.9'
- a = ?a; s = ?s
- else
- a = 'a'.ord; s = 's'.ord
- end
- i = 0
- types.each_byte do |t|
- case t
- when a then add_text strs[i]
- when s then add_lwsp strs[i]
- else
- raise "TMail FATAL: unknown flag: #{t.chr}"
- end
- i += 1
- end
- end
-
- METHOD_ID = {
- ?j => :extract_J,
- ?e => :extract_E,
- ?a => :extract_A,
- ?s => :extract_S
- }
-
- def concat_E( types, strs )
- if BENCODE_DEBUG
- puts '---- concat_E'
- puts "types=#{types.split(//).join(' ')}"
- puts "strs =#{strs.inspect}"
- end
-
- flush() unless @text.empty?
-
- chunk = ''
- strs.each_with_index do |s,i|
- mid = METHOD_ID[types[i]]
- until s.empty?
- unless c = __send__(mid, chunk.size, s)
- add_with_encode chunk unless chunk.empty?
- flush
- chunk = ''
- fold
- c = __send__(mid, 0, s)
- raise 'TMail FATAL: extract fail' unless c
- end
- chunk << c
- end
- end
- add_with_encode chunk unless chunk.empty?
- end
-
- def extract_J( chunksize, str )
- size = max_bytes(chunksize, str.size) - 6
- size = (size % 2 == 0) ? (size) : (size - 1)
- return nil if size <= 0
- if str.respond_to?(:encoding)
- enc = str.encoding
- str.force_encoding(Encoding::ASCII_8BIT)
- "\e$B#{str.slice!(0, size)}\e(B".force_encoding(enc)
- else
- "\e$B#{str.slice!(0, size)}\e(B"
- end
- end
-
- def extract_A( chunksize, str )
- size = max_bytes(chunksize, str.size)
- return nil if size <= 0
- str.slice!(0, size)
- end
-
- alias extract_S extract_A
-
- def max_bytes( chunksize, ssize )
- (restsize() - '=?iso-2022-jp?B??='.size) / 4 * 3 - chunksize
- end
-
- #
- # free length buffer
- #
-
- def add_text( str )
- @text << str
- # puts '---- text -------------------------------------'
- # puts "+ #{str.inspect}"
- # puts "txt >>>#{@text.inspect}<<<"
- end
-
- def add_with_encode( str )
- @text << "=?iso-2022-jp?B?#{Base64.encode(str)}?="
- end
-
- def add_lwsp( lwsp )
- # puts '---- lwsp -------------------------------------'
- # puts "+ #{lwsp.inspect}"
- fold if restsize() <= 0
- flush(@folded)
- @lwsp = lwsp
- end
-
- def flush(folded = false)
- # puts '---- flush ----'
- # puts "spc >>>#{@lwsp.inspect}<<<"
- # puts "txt >>>#{@text.inspect}<<<"
- @f << @lwsp << @text
- if folded
- @curlen = 0
- else
- @curlen += (@lwsp.size + @text.size)
- end
- @text = ''
- @lwsp = ''
- end
-
- def fold
- # puts '---- fold ----'
- unless @f.string =~ /^.*?:$/
- @f << @eol
- @lwsp = SPACER
- else
- fold_header
- @folded = true
- end
- @curlen = 0
- end
-
- def fold_header
- # Called because line is too long - so we need to wrap.
- # First look for whitespace in the text
- # if it has text, fold there
- # check the remaining text, if too long, fold again
- # if it doesn't, then don't fold unless the line goes beyond 998 chars
-
- # Check the text to see if there is whitespace, or if not
- @wrapped_text = []
- until @text.blank?
- fold_the_string
- end
- @text = @wrapped_text.join("#{@eol}#{SPACER}")
- end
-
- def fold_the_string
- whitespace_location = @text =~ /\s/ || @text.length
- # Is the location of the whitespace shorter than the RCF_2822_MAX_LENGTH?
- # if there is no whitespace in the string, then this
- unless mazsize(whitespace_location) <= 0
- @text.strip!
- @wrapped_text << @text.slice!(0...whitespace_location)
- # If it is not less, we have to wrap it destructively
- else
- slice_point = RFC_2822_MAX_LENGTH - @curlen - @lwsp.length
- @text.strip!
- @wrapped_text << @text.slice!(0...slice_point)
- end
- end
-
- def restsize
- MAX_LINE_LEN - (@curlen + @lwsp.size + @text.size)
- end
-
- def mazsize(whitespace_location)
- # Per RFC2822, the maximum length of a line is 998 chars
- RFC_2822_MAX_LENGTH - (@curlen + @lwsp.size + whitespace_location)
- end
-
- end
- #:startdoc:
-end # module TMail
diff --git a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/header.rb b/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/header.rb
deleted file mode 100644
index c111ea5c..00000000
--- a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/header.rb
+++ /dev/null
@@ -1,962 +0,0 @@
-#--
-# Copyright (c) 1998-2003 Minero Aoki
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-# Note: Originally licensed under LGPL v2+. Using MIT license for Rails
-# with permission of Minero Aoki.
-#++
-
-require 'tmail/encode'
-require 'tmail/address'
-require 'tmail/parser'
-require 'tmail/config'
-require 'tmail/utils'
-
-#:startdoc:
-module TMail
-
- # Provides methods to handle and manipulate headers in the email
- class HeaderField
-
- include TextUtils
-
- class << self
-
- alias newobj new
-
- def new( name, body, conf = DEFAULT_CONFIG )
- klass = FNAME_TO_CLASS[name.downcase] || UnstructuredHeader
- klass.newobj body, conf
- end
-
- # Returns a HeaderField object matching the header you specify in the "name" param.
- # Requires an initialized TMail::Port to be passed in.
- #
- # The method searches the header of the Port you pass into it to find a match on
- # the header line you pass. Once a match is found, it will unwrap the matching line
- # as needed to return an initialized HeaderField object.
- #
- # If you want to get the Envelope sender of the email object, pass in "EnvelopeSender",
- # if you want the From address of the email itself, pass in 'From'.
- #
- # This is because a mailbox doesn't have the : after the From that designates the
- # beginning of the envelope sender (which can be different to the from address of
- # the email)
- #
- # Other fields can be passed as normal, "Reply-To", "Received" etc.
- #
- # Note: Change of behaviour in 1.2.1 => returns nil if it does not find the specified
- # header field, otherwise returns an instantiated object of the correct header class
- #
- # For example:
- # port = TMail::FilePort.new("/test/fixtures/raw_email_simple")
- # h = TMail::HeaderField.new_from_port(port, "From")
- # h.addrs.to_s #=> "Mikel Lindsaar "
- # h = TMail::HeaderField.new_from_port(port, "EvelopeSender")
- # h.addrs.to_s #=> "mike@anotherplace.com.au"
- # h = TMail::HeaderField.new_from_port(port, "SomeWeirdHeaderField")
- # h #=> nil
- def new_from_port( port, name, conf = DEFAULT_CONFIG )
- if name == "EnvelopeSender"
- name = "From"
- re = Regexp.new('\A(From) ', 'i')
- else
- re = Regexp.new('\A(' + Regexp.quote(name) + '):', 'i')
- end
- str = nil
- port.ropen {|f|
- f.each do |line|
- if m = re.match(line) then str = m.post_match.strip
- elsif str and /\A[\t ]/ === line then str << ' ' << line.strip
- elsif /\A-*\s*\z/ === line then break
- elsif str then break
- end
- end
- }
- new(name, str, Config.to_config(conf)) if str
- end
-
- def internal_new( name, conf )
- FNAME_TO_CLASS[name].newobj('', conf, true)
- end
-
- end # class << self
-
- def initialize( body, conf, intern = false )
- @body = body
- @config = conf
-
- @illegal = false
- @parsed = false
-
- if intern
- @parsed = true
- parse_init
- end
- end
-
- def inspect
- "#<#{self.class} #{@body.inspect}>"
- end
-
- def illegal?
- @illegal
- end
-
- def empty?
- ensure_parsed
- return true if @illegal
- isempty?
- end
-
- private
-
- def ensure_parsed
- return if @parsed
- @parsed = true
- parse
- end
-
- # defabstract parse
- # end
-
- def clear_parse_status
- @parsed = false
- @illegal = false
- end
-
- public
-
- def body
- ensure_parsed
- v = Decoder.new(s = '')
- do_accept v
- v.terminate
- s
- end
-
- def body=( str )
- @body = str
- clear_parse_status
- end
-
- include StrategyInterface
-
- def accept( strategy )
- ensure_parsed
- do_accept strategy
- strategy.terminate
- end
-
- # abstract do_accept
-
- end
-
-
- class UnstructuredHeader < HeaderField
-
- def body
- ensure_parsed
- @body
- end
-
- def body=( arg )
- ensure_parsed
- @body = arg
- end
-
- private
-
- def parse_init
- end
-
- def parse
- @body = Decoder.decode(@body.gsub(/\n|\r\n|\r/, ''))
- end
-
- def isempty?
- not @body
- end
-
- def do_accept( strategy )
- strategy.text @body
- end
-
- end
-
-
- class StructuredHeader < HeaderField
-
- def comments
- ensure_parsed
- if @comments[0]
- [Decoder.decode(@comments[0])]
- else
- @comments
- end
- end
-
- private
-
- def parse
- save = nil
-
- begin
- parse_init
- do_parse
- rescue SyntaxError
- if not save and mime_encoded? @body
- save = @body
- @body = Decoder.decode(save)
- retry
- elsif save
- @body = save
- end
-
- @illegal = true
- raise if @config.strict_parse?
- end
- end
-
- def parse_init
- @comments = []
- init
- end
-
- def do_parse
- quote_boundary
- quote_unquoted_name
- quote_unquoted_bencode
- obj = Parser.parse(self.class::PARSE_TYPE, @body, @comments)
- set obj if obj
- end
-
- end
-
-
- class DateTimeHeader < StructuredHeader
-
- PARSE_TYPE = :DATETIME
-
- def date
- ensure_parsed
- @date
- end
-
- def date=( arg )
- ensure_parsed
- @date = arg
- end
-
- private
-
- def init
- @date = nil
- end
-
- def set( t )
- @date = t
- end
-
- def isempty?
- not @date
- end
-
- def do_accept( strategy )
- strategy.meta time2str(@date)
- end
-
- end
-
-
- class AddressHeader < StructuredHeader
-
- PARSE_TYPE = :MADDRESS
-
- def addrs
- ensure_parsed
- @addrs
- end
-
- private
-
- def init
- @addrs = []
- end
-
- def set( a )
- @addrs = a
- end
-
- def isempty?
- @addrs.empty?
- end
-
- def do_accept( strategy )
- first = true
- @addrs.each do |a|
- if first
- first = false
- else
- strategy.puts_meta ','
- strategy.space
- end
- a.accept strategy
- end
-
- @comments.each do |c|
- strategy.space
- strategy.meta '('
- strategy.text c
- strategy.meta ')'
- end
- end
-
- end
-
-
- class ReturnPathHeader < AddressHeader
-
- PARSE_TYPE = :RETPATH
-
- def addr
- addrs()[0]
- end
-
- def spec
- a = addr() or return nil
- a.spec
- end
-
- def routes
- a = addr() or return nil
- a.routes
- end
-
- private
-
- def do_accept( strategy )
- a = addr()
-
- strategy.meta '<'
- unless a.routes.empty?
- strategy.meta a.routes.map {|i| '@' + i }.join(',')
- strategy.meta ':'
- end
- spec = a.spec
- strategy.meta spec if spec
- strategy.meta '>'
- end
-
- end
-
-
- class SingleAddressHeader < AddressHeader
-
- def addr
- addrs()[0]
- end
-
- private
-
- def do_accept( strategy )
- a = addr()
- a.accept strategy
- @comments.each do |c|
- strategy.space
- strategy.meta '('
- strategy.text c
- strategy.meta ')'
- end
- end
-
- end
-
-
- class MessageIdHeader < StructuredHeader
-
- def id
- ensure_parsed
- @id
- end
-
- def id=( arg )
- ensure_parsed
- @id = arg
- end
-
- private
-
- def init
- @id = nil
- end
-
- def isempty?
- not @id
- end
-
- def do_parse
- @id = @body.slice(MESSAGE_ID) or
- raise SyntaxError, "wrong Message-ID format: #{@body}"
- end
-
- def do_accept( strategy )
- strategy.meta @id
- end
-
- end
-
-
- class ReferencesHeader < StructuredHeader
-
- def refs
- ensure_parsed
- @refs
- end
-
- def each_id
- self.refs.each do |i|
- yield i if MESSAGE_ID === i
- end
- end
-
- def ids
- ensure_parsed
- @ids
- end
-
- def each_phrase
- self.refs.each do |i|
- yield i unless MESSAGE_ID === i
- end
- end
-
- def phrases
- ret = []
- each_phrase {|i| ret.push i }
- ret
- end
-
- private
-
- def init
- @refs = []
- @ids = []
- end
-
- def isempty?
- @ids.empty?
- end
-
- def do_parse
- str = @body
- while m = MESSAGE_ID.match(str)
- pre = m.pre_match.strip
- @refs.push pre unless pre.empty?
- @refs.push s = m[0]
- @ids.push s
- str = m.post_match
- end
- str = str.strip
- @refs.push str unless str.empty?
- end
-
- def do_accept( strategy )
- first = true
- @ids.each do |i|
- if first
- first = false
- else
- strategy.space
- end
- strategy.meta i
- end
- end
-
- end
-
-
- class ReceivedHeader < StructuredHeader
-
- PARSE_TYPE = :RECEIVED
-
- def from
- ensure_parsed
- @from
- end
-
- def from=( arg )
- ensure_parsed
- @from = arg
- end
-
- def by
- ensure_parsed
- @by
- end
-
- def by=( arg )
- ensure_parsed
- @by = arg
- end
-
- def via
- ensure_parsed
- @via
- end
-
- def via=( arg )
- ensure_parsed
- @via = arg
- end
-
- def with
- ensure_parsed
- @with
- end
-
- def id
- ensure_parsed
- @id
- end
-
- def id=( arg )
- ensure_parsed
- @id = arg
- end
-
- def _for
- ensure_parsed
- @_for
- end
-
- def _for=( arg )
- ensure_parsed
- @_for = arg
- end
-
- def date
- ensure_parsed
- @date
- end
-
- def date=( arg )
- ensure_parsed
- @date = arg
- end
-
- private
-
- def init
- @from = @by = @via = @with = @id = @_for = nil
- @with = []
- @date = nil
- end
-
- def set( args )
- @from, @by, @via, @with, @id, @_for, @date = *args
- end
-
- def isempty?
- @with.empty? and not (@from or @by or @via or @id or @_for or @date)
- end
-
- def do_accept( strategy )
- list = []
- list.push 'from ' + @from if @from
- list.push 'by ' + @by if @by
- list.push 'via ' + @via if @via
- @with.each do |i|
- list.push 'with ' + i
- end
- list.push 'id ' + @id if @id
- list.push 'for <' + @_for + '>' if @_for
-
- first = true
- list.each do |i|
- strategy.space unless first
- strategy.meta i
- first = false
- end
- if @date
- strategy.meta ';'
- strategy.space
- strategy.meta time2str(@date)
- end
- end
-
- end
-
-
- class KeywordsHeader < StructuredHeader
-
- PARSE_TYPE = :KEYWORDS
-
- def keys
- ensure_parsed
- @keys
- end
-
- private
-
- def init
- @keys = []
- end
-
- def set( a )
- @keys = a
- end
-
- def isempty?
- @keys.empty?
- end
-
- def do_accept( strategy )
- first = true
- @keys.each do |i|
- if first
- first = false
- else
- strategy.meta ','
- end
- strategy.meta i
- end
- end
-
- end
-
-
- class EncryptedHeader < StructuredHeader
-
- PARSE_TYPE = :ENCRYPTED
-
- def encrypter
- ensure_parsed
- @encrypter
- end
-
- def encrypter=( arg )
- ensure_parsed
- @encrypter = arg
- end
-
- def keyword
- ensure_parsed
- @keyword
- end
-
- def keyword=( arg )
- ensure_parsed
- @keyword = arg
- end
-
- private
-
- def init
- @encrypter = nil
- @keyword = nil
- end
-
- def set( args )
- @encrypter, @keyword = args
- end
-
- def isempty?
- not (@encrypter or @keyword)
- end
-
- def do_accept( strategy )
- if @key
- strategy.meta @encrypter + ','
- strategy.space
- strategy.meta @keyword
- else
- strategy.meta @encrypter
- end
- end
-
- end
-
-
- class MimeVersionHeader < StructuredHeader
-
- PARSE_TYPE = :MIMEVERSION
-
- def major
- ensure_parsed
- @major
- end
-
- def major=( arg )
- ensure_parsed
- @major = arg
- end
-
- def minor
- ensure_parsed
- @minor
- end
-
- def minor=( arg )
- ensure_parsed
- @minor = arg
- end
-
- def version
- sprintf('%d.%d', major, minor)
- end
-
- private
-
- def init
- @major = nil
- @minor = nil
- end
-
- def set( args )
- @major, @minor = *args
- end
-
- def isempty?
- not (@major or @minor)
- end
-
- def do_accept( strategy )
- strategy.meta sprintf('%d.%d', @major, @minor)
- end
-
- end
-
-
- class ContentTypeHeader < StructuredHeader
-
- PARSE_TYPE = :CTYPE
-
- def main_type
- ensure_parsed
- @main
- end
-
- def main_type=( arg )
- ensure_parsed
- @main = arg.downcase
- end
-
- def sub_type
- ensure_parsed
- @sub
- end
-
- def sub_type=( arg )
- ensure_parsed
- @sub = arg.downcase
- end
-
- def content_type
- ensure_parsed
- @sub ? sprintf('%s/%s', @main, @sub) : @main
- end
-
- def params
- ensure_parsed
- unless @params.blank?
- @params.each do |k, v|
- @params[k] = unquote(v)
- end
- end
- @params
- end
-
- def []( key )
- ensure_parsed
- @params and unquote(@params[key])
- end
-
- def []=( key, val )
- ensure_parsed
- (@params ||= {})[key] = val
- end
-
- private
-
- def init
- @main = @sub = @params = nil
- end
-
- def set( args )
- @main, @sub, @params = *args
- end
-
- def isempty?
- not (@main or @sub)
- end
-
- def do_accept( strategy )
- if @sub
- strategy.meta sprintf('%s/%s', @main, @sub)
- else
- strategy.meta @main
- end
- @params.each do |k,v|
- if v
- strategy.meta ';'
- strategy.space
- strategy.kv_pair k, unquote(v)
- end
- end
- end
-
- end
-
-
- class ContentTransferEncodingHeader < StructuredHeader
-
- PARSE_TYPE = :CENCODING
-
- def encoding
- ensure_parsed
- @encoding
- end
-
- def encoding=( arg )
- ensure_parsed
- @encoding = arg
- end
-
- private
-
- def init
- @encoding = nil
- end
-
- def set( s )
- @encoding = s
- end
-
- def isempty?
- not @encoding
- end
-
- def do_accept( strategy )
- strategy.meta @encoding.capitalize
- end
-
- end
-
-
- class ContentDispositionHeader < StructuredHeader
-
- PARSE_TYPE = :CDISPOSITION
-
- def disposition
- ensure_parsed
- @disposition
- end
-
- def disposition=( str )
- ensure_parsed
- @disposition = str.downcase
- end
-
- def params
- ensure_parsed
- unless @params.blank?
- @params.each do |k, v|
- @params[k] = unquote(v)
- end
- end
- @params
- end
-
- def []( key )
- ensure_parsed
- @params and unquote(@params[key])
- end
-
- def []=( key, val )
- ensure_parsed
- (@params ||= {})[key] = val
- end
-
- private
-
- def init
- @disposition = @params = nil
- end
-
- def set( args )
- @disposition, @params = *args
- end
-
- def isempty?
- not @disposition and (not @params or @params.empty?)
- end
-
- def do_accept( strategy )
- strategy.meta @disposition
- @params.each do |k,v|
- strategy.meta ';'
- strategy.space
- strategy.kv_pair k, unquote(v)
- end
- end
-
- end
-
-
- class HeaderField # redefine
-
- FNAME_TO_CLASS = {
- 'date' => DateTimeHeader,
- 'resent-date' => DateTimeHeader,
- 'to' => AddressHeader,
- 'cc' => AddressHeader,
- 'bcc' => AddressHeader,
- 'from' => AddressHeader,
- 'reply-to' => AddressHeader,
- 'resent-to' => AddressHeader,
- 'resent-cc' => AddressHeader,
- 'resent-bcc' => AddressHeader,
- 'resent-from' => AddressHeader,
- 'resent-reply-to' => AddressHeader,
- 'sender' => SingleAddressHeader,
- 'resent-sender' => SingleAddressHeader,
- 'return-path' => ReturnPathHeader,
- 'message-id' => MessageIdHeader,
- 'resent-message-id' => MessageIdHeader,
- 'in-reply-to' => ReferencesHeader,
- 'received' => ReceivedHeader,
- 'references' => ReferencesHeader,
- 'keywords' => KeywordsHeader,
- 'encrypted' => EncryptedHeader,
- 'mime-version' => MimeVersionHeader,
- 'content-type' => ContentTypeHeader,
- 'content-transfer-encoding' => ContentTransferEncodingHeader,
- 'content-disposition' => ContentDispositionHeader,
- 'content-id' => MessageIdHeader,
- 'subject' => UnstructuredHeader,
- 'comments' => UnstructuredHeader,
- 'content-description' => UnstructuredHeader
- }
-
- end
-
-end # module TMail
diff --git a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/index.rb b/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/index.rb
deleted file mode 100644
index 554e2fd6..00000000
--- a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/index.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-#:stopdoc:
-# This is here for Rolls.
-# Rolls uses this instead of lib/tmail.rb.
-
-require 'tmail/version'
-require 'tmail/mail'
-require 'tmail/mailbox'
-require 'tmail/core_extensions'
-#:startdoc:
\ No newline at end of file
diff --git a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/interface.rb b/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/interface.rb
deleted file mode 100644
index 27680c15..00000000
--- a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/interface.rb
+++ /dev/null
@@ -1,1162 +0,0 @@
-=begin rdoc
-
-= interface.rb Provides an interface to the TMail object
-
-=end
-#--
-# Copyright (c) 1998-2003 Minero Aoki
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-# Note: Originally licensed under LGPL v2+. Using MIT license for Rails
-# with permission of Minero Aoki.
-#++
-
-# TMail::Mail objects get accessed primarily through the methods in this file.
-#
-#
-
-require 'tmail/utils'
-
-module TMail
-
- class Mail
-
- # Allows you to query the mail object with a string to get the contents
- # of the field you want.
- #
- # Returns a string of the exact contents of the field
- #
- # mail.from = "mikel "
- # mail.header_string("From") #=> "mikel "
- def header_string( name, default = nil )
- h = @header[name.downcase] or return default
- h.to_s
- end
-
- #:stopdoc:
- #--
- #== Attributes
-
- include TextUtils
-
- def set_string_array_attr( key, strs )
- strs.flatten!
- if strs.empty?
- @header.delete key.downcase
- else
- store key, strs.join(', ')
- end
- strs
- end
- private :set_string_array_attr
-
- def set_string_attr( key, str )
- if str
- store key, str
- else
- @header.delete key.downcase
- end
- str
- end
- private :set_string_attr
-
- def set_addrfield( name, arg )
- if arg
- h = HeaderField.internal_new(name, @config)
- h.addrs.replace [arg].flatten
- @header[name] = h
- else
- @header.delete name
- end
- arg
- end
- private :set_addrfield
-
- def addrs2specs( addrs )
- return nil unless addrs
- list = addrs.map {|addr|
- if addr.address_group?
- then addr.map {|a| a.spec }
- else addr.spec
- end
- }.flatten
- return nil if list.empty?
- list
- end
- private :addrs2specs
-
- #:startdoc:
-
- #== Date and Time methods
-
- # Returns the date of the email message as per the "date" header value or returns
- # nil by default (if no date field exists).
- #
- # You can also pass whatever default you want into this method and it will return
- # that instead of nil if there is no date already set.
- def date( default = nil )
- if h = @header['date']
- h.date
- else
- default
- end
- end
-
- # Destructively sets the date of the mail object with the passed Time instance,
- # returns a Time instance set to the date/time of the mail
- #
- # Example:
- #
- # now = Time.now
- # mail.date = now
- # mail.date #=> Sat Nov 03 18:47:50 +1100 2007
- # mail.date.class #=> Time
- def date=( time )
- if time
- store 'Date', time2str(time)
- else
- @header.delete 'date'
- end
- time
- end
-
- # Returns the time of the mail message formatted to your taste using a
- # strftime format string. If no date set returns nil by default or whatever value
- # you pass as the second optional parameter.
- #
- # time = Time.now # (on Nov 16 2007)
- # mail.date = time
- # mail.strftime("%D") #=> "11/16/07"
- def strftime( fmt, default = nil )
- if t = date
- t.strftime(fmt)
- else
- default
- end
- end
-
- #== Destination methods
-
- # Return a TMail::Addresses instance for each entry in the "To:" field of the mail object header.
- #
- # If the "To:" field does not exist, will return nil by default or the value you
- # pass as the optional parameter.
- #
- # Example:
- #
- # mail = TMail::Mail.new
- # mail.to_addrs #=> nil
- # mail.to_addrs([]) #=> []
- # mail.to = "Mikel , another Mikel "
- # mail.to_addrs #=> [#, #]
- def to_addrs( default = nil )
- if h = @header['to']
- h.addrs
- else
- default
- end
- end
-
- # Return a TMail::Addresses instance for each entry in the "Cc:" field of the mail object header.
- #
- # If the "Cc:" field does not exist, will return nil by default or the value you
- # pass as the optional parameter.
- #
- # Example:
- #
- # mail = TMail::Mail.new
- # mail.cc_addrs #=> nil
- # mail.cc_addrs([]) #=> []
- # mail.cc = "Mikel , another Mikel "
- # mail.cc_addrs #=> [#, #]
- def cc_addrs( default = nil )
- if h = @header['cc']
- h.addrs
- else
- default
- end
- end
-
- # Return a TMail::Addresses instance for each entry in the "Bcc:" field of the mail object header.
- #
- # If the "Bcc:" field does not exist, will return nil by default or the value you
- # pass as the optional parameter.
- #
- # Example:
- #
- # mail = TMail::Mail.new
- # mail.bcc_addrs #=> nil
- # mail.bcc_addrs([]) #=> []
- # mail.bcc = "Mikel , another Mikel "
- # mail.bcc_addrs #=> [#, #]
- def bcc_addrs( default = nil )
- if h = @header['bcc']
- h.addrs
- else
- default
- end
- end
-
- # Destructively set the to field of the "To:" header to equal the passed in string.
- #
- # TMail will parse your contents and turn each valid email address into a TMail::Address
- # object before assigning it to the mail message.
- #
- # Example:
- #
- # mail = TMail::Mail.new
- # mail.to = "Mikel , another Mikel "
- # mail.to_addrs #=> [#, #]
- def to_addrs=( arg )
- set_addrfield 'to', arg
- end
-
- # Destructively set the to field of the "Cc:" header to equal the passed in string.
- #
- # TMail will parse your contents and turn each valid email address into a TMail::Address
- # object before assigning it to the mail message.
- #
- # Example:
- #
- # mail = TMail::Mail.new
- # mail.cc = "Mikel , another Mikel "
- # mail.cc_addrs #=> [#, #]
- def cc_addrs=( arg )
- set_addrfield 'cc', arg
- end
-
- # Destructively set the to field of the "Bcc:" header to equal the passed in string.
- #
- # TMail will parse your contents and turn each valid email address into a TMail::Address
- # object before assigning it to the mail message.
- #
- # Example:
- #
- # mail = TMail::Mail.new
- # mail.bcc = "Mikel , another Mikel "
- # mail.bcc_addrs #=> [#, #]
- def bcc_addrs=( arg )
- set_addrfield 'bcc', arg
- end
-
- # Returns who the email is to as an Array of email addresses as opposed to an Array of
- # TMail::Address objects which is what Mail#to_addrs returns
- #
- # Example:
- #
- # mail = TMail::Mail.new
- # mail.to = "Mikel , another Mikel "
- # mail.to #=> ["mikel@me.org", "mikel@you.org"]
- def to( default = nil )
- addrs2specs(to_addrs(nil)) || default
- end
-
- # Returns who the email cc'd as an Array of email addresses as opposed to an Array of
- # TMail::Address objects which is what Mail#to_addrs returns
- #
- # Example:
- #
- # mail = TMail::Mail.new
- # mail.cc = "Mikel , another Mikel "
- # mail.cc #=> ["mikel@me.org", "mikel@you.org"]
- def cc( default = nil )
- addrs2specs(cc_addrs(nil)) || default
- end
-
- # Returns who the email bcc'd as an Array of email addresses as opposed to an Array of
- # TMail::Address objects which is what Mail#to_addrs returns
- #
- # Example:
- #
- # mail = TMail::Mail.new
- # mail.bcc = "Mikel , another Mikel "
- # mail.bcc #=> ["mikel@me.org", "mikel@you.org"]
- def bcc( default = nil )
- addrs2specs(bcc_addrs(nil)) || default
- end
-
- # Destructively sets the "To:" field to the passed array of strings (which should be valid
- # email addresses)
- #
- # Example:
- #
- # mail = TMail::Mail.new
- # mail.to = ["mikel@abc.com", "Mikel "]
- # mail.to #=> ["mikel@abc.org", "mikel@xyz.org"]
- # mail['to'].to_s #=> "mikel@abc.com, Mikel "
- def to=( *strs )
- set_string_array_attr 'To', strs
- end
-
- # Destructively sets the "Cc:" field to the passed array of strings (which should be valid
- # email addresses)
- #
- # Example:
- #
- # mail = TMail::Mail.new
- # mail.cc = ["mikel@abc.com", "Mikel "]
- # mail.cc #=> ["mikel@abc.org", "mikel@xyz.org"]
- # mail['cc'].to_s #=> "mikel@abc.com, Mikel "
- def cc=( *strs )
- set_string_array_attr 'Cc', strs
- end
-
- # Destructively sets the "Bcc:" field to the passed array of strings (which should be valid
- # email addresses)
- #
- # Example:
- #
- # mail = TMail::Mail.new
- # mail.bcc = ["mikel@abc.com", "Mikel "]
- # mail.bcc #=> ["mikel@abc.org", "mikel@xyz.org"]
- # mail['bcc'].to_s #=> "mikel@abc.com, Mikel "
- def bcc=( *strs )
- set_string_array_attr 'Bcc', strs
- end
-
- #== Originator methods
-
- # Return a TMail::Addresses instance for each entry in the "From:" field of the mail object header.
- #
- # If the "From:" field does not exist, will return nil by default or the value you
- # pass as the optional parameter.
- #
- # Example:
- #
- # mail = TMail::Mail.new
- # mail.from_addrs #=> nil
- # mail.from_addrs([]) #=> []
- # mail.from = "Mikel , another Mikel "
- # mail.from_addrs #=> [#, #]
- def from_addrs( default = nil )
- if h = @header['from']
- h.addrs
- else
- default
- end
- end
-
- # Destructively set the to value of the "From:" header to equal the passed in string.
- #
- # TMail will parse your contents and turn each valid email address into a TMail::Address
- # object before assigning it to the mail message.
- #
- # Example:
- #
- # mail = TMail::Mail.new
- # mail.from_addrs = "Mikel , another Mikel "
- # mail.from_addrs #=> [#, #]
- def from_addrs=( arg )
- set_addrfield 'from', arg
- end
-
- # Returns who the email is from as an Array of email address strings instead to an Array of
- # TMail::Address objects which is what Mail#from_addrs returns
- #
- # Example:
- #
- # mail = TMail::Mail.new
- # mail.from = "Mikel , another Mikel "
- # mail.from #=> ["mikel@me.org", "mikel@you.org"]
- def from( default = nil )
- addrs2specs(from_addrs(nil)) || default
- end
-
- # Destructively sets the "From:" field to the passed array of strings (which should be valid
- # email addresses)
- #
- # Example:
- #
- # mail = TMail::Mail.new
- # mail.from = ["mikel@abc.com", "Mikel "]
- # mail.from #=> ["mikel@abc.org", "mikel@xyz.org"]
- # mail['from'].to_s #=> "mikel@abc.com, Mikel "
- def from=( *strs )
- set_string_array_attr 'From', strs
- end
-
- # Returns the "friendly" human readable part of the address
- #
- # Example:
- #
- # mail = TMail::Mail.new
- # mail.from = "Mikel Lindsaar "
- # mail.friendly_from #=> "Mikel Lindsaar"
- def friendly_from( default = nil )
- h = @header['from']
- a, = h.addrs
- return default unless a
- return a.phrase if a.phrase
- return h.comments.join(' ') unless h.comments.empty?
- a.spec
- end
-
- # Return a TMail::Addresses instance for each entry in the "Reply-To:" field of the mail object header.
- #
- # If the "Reply-To:" field does not exist, will return nil by default or the value you
- # pass as the optional parameter.
- #
- # Example:
- #
- # mail = TMail::Mail.new
- # mail.reply_to_addrs #=> nil
- # mail.reply_to_addrs([]) #=> []
- # mail.reply_to = "Mikel , another Mikel "
- # mail.reply_to_addrs #=> [#, #]
- def reply_to_addrs( default = nil )
- if h = @header['reply-to']
- h.addrs.blank? ? default : h.addrs
- else
- default
- end
- end
-
- # Destructively set the to value of the "Reply-To:" header to equal the passed in argument.
- #
- # TMail will parse your contents and turn each valid email address into a TMail::Address
- # object before assigning it to the mail message.
- #
- # Example:
- #
- # mail = TMail::Mail.new
- # mail.reply_to_addrs = "Mikel , another Mikel "
- # mail.reply_to_addrs #=> [#, #]
- def reply_to_addrs=( arg )
- set_addrfield 'reply-to', arg
- end
-
- # Returns who the email is from as an Array of email address strings instead to an Array of
- # TMail::Address objects which is what Mail#reply_to_addrs returns
- #
- # Example:
- #
- # mail = TMail::Mail.new
- # mail.reply_to = "Mikel , another Mikel "
- # mail.reply_to #=> ["mikel@me.org", "mikel@you.org"]
- def reply_to( default = nil )
- addrs2specs(reply_to_addrs(nil)) || default
- end
-
- # Destructively sets the "Reply-To:" field to the passed array of strings (which should be valid
- # email addresses)
- #
- # Example:
- #
- # mail = TMail::Mail.new
- # mail.reply_to = ["mikel@abc.com", "Mikel "]
- # mail.reply_to #=> ["mikel@abc.org", "mikel@xyz.org"]
- # mail['reply_to'].to_s #=> "mikel@abc.com, Mikel "
- def reply_to=( *strs )
- set_string_array_attr 'Reply-To', strs
- end
-
- # Return a TMail::Addresses instance of the "Sender:" field of the mail object header.
- #
- # If the "Sender:" field does not exist, will return nil by default or the value you
- # pass as the optional parameter.
- #
- # Example:
- #
- # mail = TMail::Mail.new
- # mail.sender #=> nil
- # mail.sender([]) #=> []
- # mail.sender = "Mikel "
- # mail.reply_to_addrs #=> [#]
- def sender_addr( default = nil )
- f = @header['sender'] or return default
- f.addr or return default
- end
-
- # Destructively set the to value of the "Sender:" header to equal the passed in argument.
- #
- # TMail will parse your contents and turn each valid email address into a TMail::Address
- # object before assigning it to the mail message.
- #
- # Example:
- #
- # mail = TMail::Mail.new
- # mail.sender_addrs = "Mikel , another Mikel "
- # mail.sender_addrs #=> [#, #]
- def sender_addr=( addr )
- if addr
- h = HeaderField.internal_new('sender', @config)
- h.addr = addr
- @header['sender'] = h
- else
- @header.delete 'sender'
- end
- addr
- end
-
- # Returns who the sender of this mail is as string instead to an Array of
- # TMail::Address objects which is what Mail#sender_addr returns
- #
- # Example:
- #
- # mail = TMail::Mail.new
- # mail.sender = "Mikel "
- # mail.sender #=> "mikel@me.org"
- def sender( default = nil )
- f = @header['sender'] or return default
- a = f.addr or return default
- a.spec
- end
-
- # Destructively sets the "Sender:" field to the passed string (which should be a valid
- # email address)
- #
- # Example:
- #
- # mail = TMail::Mail.new
- # mail.sender = "mikel@abc.com"
- # mail.sender #=> "mikel@abc.org"
- # mail['sender'].to_s #=> "mikel@abc.com"
- def sender=( str )
- set_string_attr 'Sender', str
- end
-
- #== Subject methods
-
- # Returns the subject of the mail instance.
- #
- # If the subject field does not exist, returns nil by default or you can pass in as
- # the parameter for what you want the default value to be.
- #
- # Example:
- #
- # mail = TMail::Mail.new
- # mail.subject #=> nil
- # mail.subject("") #=> ""
- # mail.subject = "Hello"
- # mail.subject #=> "Hello"
- def subject( default = nil )
- if h = @header['subject']
- h.body
- else
- default
- end
- end
- alias quoted_subject subject
-
- # Destructively sets the passed string as the subject of the mail message.
- #
- # Example
- #
- # mail = TMail::Mail.new
- # mail.subject #=> "This subject"
- # mail.subject = "Another subject"
- # mail.subject #=> "Another subject"
- def subject=( str )
- set_string_attr 'Subject', str
- end
-
- #== Message Identity & Threading Methods
-
- # Returns the message ID for this mail object instance.
- #
- # If the message_id field does not exist, returns nil by default or you can pass in as
- # the parameter for what you want the default value to be.
- #
- # Example:
- #
- # mail = TMail::Mail.new
- # mail.message_id #=> nil
- # mail.message_id(TMail.new_message_id) #=> "<47404c5326d9c_2ad4fbb80161@baci.local.tmail>"
- # mail.message_id = TMail.new_message_id
- # mail.message_id #=> "<47404c5326d9c_2ad4fbb80161@baci.local.tmail>"
- def message_id( default = nil )
- if h = @header['message-id']
- h.id || default
- else
- default
- end
- end
-
- # Destructively sets the message ID of the mail object instance to the passed in string
- #
- # Invalid message IDs are ignored (silently, unless configured otherwise) and result in
- # a nil message ID. Left and right angle brackets are required.
- #
- # Be warned however, that calling mail.ready_to_send will overwrite whatever value you
- # have in this field with an automatically generated unique value.
- #
- # If you really want to set your own message ID and know what you are doing per the
- # various RFCs, you can do so with the enforced_message_id= command
- #
- # Example:
- #
- # mail = TMail::Mail.new
- # mail.message_id = "<348F04F142D69C21-291E56D292BC@xxxx.net>"
- # mail.message_id #=> "<348F04F142D69C21-291E56D292BC@xxxx.net>"
- # mail.message_id = "this_is_my_badly_formatted_message_id"
- # mail.message_id #=> nil
- def message_id=( str )
- set_string_attr 'Message-Id', str
- end
-
- # Destructively sets the message ID of the mail object instance to the passed in string
- # and also guarantees that calling #ready_to_send will not destroy what you set as the
- # message_id
- #
- # Example:
- #
- # mail = TMail::Mail.new
- # mail.message_id = "<348F04F142D69C21-291E56D292BC@xxxx.net>"
- # mail.message_id #=> "<348F04F142D69C21-291E56D292BC@xxxx.net>"
- # mail.ready_to_send
- # mail.message_id #=> "<348F04F142D69C21-291E56D292BC@xxxx.net>"
- def enforced_message_id=( str )
- @message_id_enforced = true
- self.message_id = ( str )
- end
-
- # Returns the "In-Reply-To:" field contents as an array of this mail instance if it exists
- #
- # If the in_reply_to field does not exist, returns nil by default or you can pass in as
- # the parameter for what you want the default value to be.
- #
- # Example:
- #
- # mail = TMail::Mail.new
- # mail.in_reply_to #=> nil
- # mail.in_reply_to([]) #=> []
- # TMail::Mail.load("../test/fixtures/raw_email_reply")
- # mail.in_reply_to #=> ["<348F04F142D69C21-291E56D292BC@xxxx.net>"]
- def in_reply_to( default = nil )
- if h = @header['in-reply-to']
- h.ids
- else
- default
- end
- end
-
- # Destructively sets the value of the "In-Reply-To:" field of an email.
- #
- # Accepts an array of a single string of a message id
- #
- # Example:
- #
- # mail = TMail::Mail.new
- # mail.in_reply_to = ["<348F04F142D69C21-291E56D292BC@xxxx.net>"]
- # mail.in_reply_to #=> ["<348F04F142D69C21-291E56D292BC@xxxx.net>"]
- def in_reply_to=( *idstrs )
- set_string_array_attr 'In-Reply-To', idstrs
- end
-
- # Returns the references of this email (prior messages relating to this message)
- # as an array of message ID strings. Useful when you are trying to thread an
- # email.
- #
- # If the references field does not exist, returns nil by default or you can pass in as
- # the parameter for what you want the default value to be.
- #
- # Example:
- #
- # mail = TMail::Mail.new
- # mail.references #=> nil
- # mail.references([]) #=> []
- # mail = TMail::Mail.load("../test/fixtures/raw_email_reply")
- # mail.references #=> ["<473FF3B8.9020707@xxx.org>", "<348F04F142D69C21-291E56D292BC@xxxx.net>"]
- def references( default = nil )
- if h = @header['references']
- h.refs
- else
- default
- end
- end
-
- # Destructively sets the value of the "References:" field of an email.
- #
- # Accepts an array of strings of message IDs
- #
- # Example:
- #
- # mail = TMail::Mail.new
- # mail.references = ["<348F04F142D69C21-291E56D292BC@xxxx.net>"]
- # mail.references #=> ["<348F04F142D69C21-291E56D292BC@xxxx.net>"]
- def references=( *strs )
- set_string_array_attr 'References', strs
- end
-
- #== MIME header methods
-
- # Returns the listed MIME version of this email from the "Mime-Version:" header field
- #
- # If the mime_version field does not exist, returns nil by default or you can pass in as
- # the parameter for what you want the default value to be.
- #
- # Example:
- #
- # mail = TMail::Mail.new
- # mail.mime_version #=> nil
- # mail.mime_version([]) #=> []
- # mail = TMail::Mail.load("../test/fixtures/raw_email")
- # mail.mime_version #=> "1.0"
- def mime_version( default = nil )
- if h = @header['mime-version']
- h.version || default
- else
- default
- end
- end
-
- def mime_version=( m, opt = nil )
- if opt
- if h = @header['mime-version']
- h.major = m
- h.minor = opt
- else
- store 'Mime-Version', "#{m}.#{opt}"
- end
- else
- store 'Mime-Version', m
- end
- m
- end
-
- # Returns the current "Content-Type" of the mail instance.
- #
- # If the content_type field does not exist, returns nil by default or you can pass in as
- # the parameter for what you want the default value to be.
- #
- # Example:
- #
- # mail = TMail::Mail.new
- # mail.content_type #=> nil
- # mail.content_type([]) #=> []
- # mail = TMail::Mail.load("../test/fixtures/raw_email")
- # mail.content_type #=> "text/plain"
- def content_type( default = nil )
- if h = @header['content-type']
- h.content_type || default
- else
- default
- end
- end
-
- # Returns the current main type of the "Content-Type" of the mail instance.
- #
- # If the content_type field does not exist, returns nil by default or you can pass in as
- # the parameter for what you want the default value to be.
- #
- # Example:
- #
- # mail = TMail::Mail.new
- # mail.main_type #=> nil
- # mail.main_type([]) #=> []
- # mail = TMail::Mail.load("../test/fixtures/raw_email")
- # mail.main_type #=> "text"
- def main_type( default = nil )
- if h = @header['content-type']
- h.main_type || default
- else
- default
- end
- end
-
- # Returns the current sub type of the "Content-Type" of the mail instance.
- #
- # If the content_type field does not exist, returns nil by default or you can pass in as
- # the parameter for what you want the default value to be.
- #
- # Example:
- #
- # mail = TMail::Mail.new
- # mail.sub_type #=> nil
- # mail.sub_type([]) #=> []
- # mail = TMail::Mail.load("../test/fixtures/raw_email")
- # mail.sub_type #=> "plain"
- def sub_type( default = nil )
- if h = @header['content-type']
- h.sub_type || default
- else
- default
- end
- end
-
- # Destructively sets the "Content-Type:" header field of this mail object
- #
- # Allows you to set the main type, sub type as well as parameters to the field.
- # The main type and sub type need to be a string.
- #
- # The optional params hash can be passed with keys as symbols and values as a string,
- # or strings as keys and values.
- #
- # Example:
- #
- # mail = TMail::Mail.new
- # mail.set_content_type("text", "plain")
- # mail.to_s #=> "Content-Type: text/plain\n\n"
- #
- # mail.set_content_type("text", "plain", {:charset => "EUC-KR", :format => "flowed"})
- # mail.to_s #=> "Content-Type: text/plain; charset=EUC-KR; format=flowed\n\n"
- #
- # mail.set_content_type("text", "plain", {"charset" => "EUC-KR", "format" => "flowed"})
- # mail.to_s #=> "Content-Type: text/plain; charset=EUC-KR; format=flowed\n\n"
- def set_content_type( str, sub = nil, param = nil )
- if sub
- main, sub = str, sub
- else
- main, sub = str.split(%r>, 2)
- raise ArgumentError, "sub type missing: #{str.inspect}" unless sub
- end
- if h = @header['content-type']
- h.main_type = main
- h.sub_type = sub
- h.params.clear
- else
- store 'Content-Type', "#{main}/#{sub}"
- end
- @header['content-type'].params.replace param if param
- str
- end
-
- alias content_type= set_content_type
-
- # Returns the named type parameter as a string, from the "Content-Type:" header.
- #
- # Example:
- #
- # mail = TMail::Mail.new
- # mail.type_param("charset") #=> nil
- # mail.type_param("charset", []) #=> []
- # mail.set_content_type("text", "plain", {:charset => "EUC-KR", :format => "flowed"})
- # mail.type_param("charset") #=> "EUC-KR"
- # mail.type_param("format") #=> "flowed"
- def type_param( name, default = nil )
- if h = @header['content-type']
- h[name] || default
- else
- default
- end
- end
-
- # Returns the character set of the email. Returns nil if no encoding set or returns
- # whatever default you pass as a parameter - note passing the parameter does NOT change
- # the mail object in any way.
- #
- # Example:
- #
- # mail = TMail::Mail.load("path_to/utf8_email")
- # mail.charset #=> "UTF-8"
- #
- # mail = TMail::Mail.new
- # mail.charset #=> nil
- # mail.charset("US-ASCII") #=> "US-ASCII"
- def charset( default = nil )
- if h = @header['content-type']
- h['charset'] or default
- else
- mime_version_charset || default
- end
- end
-
- # some weird emails come with the charset specified in the mime-version header:
- #
- # #
- #
- def mime_version_charset
- if header['mime-version'].inspect =~ /charset=('|\\")?([^\\"']+)/
- $2
- end
- end
-
- # Destructively sets the character set used by this mail object to the passed string, you
- # should note though that this does nothing to the mail body, just changes the header
- # value, you will need to transliterate the body as well to match whatever you put
- # in this header value if you are changing character sets.
- #
- # Example:
- #
- # mail = TMail::Mail.new
- # mail.charset #=> nil
- # mail.charset = "UTF-8"
- # mail.charset #=> "UTF-8"
- def charset=( str )
- if str
- if h = @header[ 'content-type' ]
- h['charset'] = str
- else
- store 'Content-Type', "text/plain; charset=#{str}"
- end
- end
- str
- end
-
- # Returns the transfer encoding of the email. Returns nil if no encoding set or returns
- # whatever default you pass as a parameter - note passing the parameter does NOT change
- # the mail object in any way.
- #
- # Example:
- #
- # mail = TMail::Mail.load("path_to/base64_encoded_email")
- # mail.transfer_encoding #=> "base64"
- #
- # mail = TMail::Mail.new
- # mail.transfer_encoding #=> nil
- # mail.transfer_encoding("base64") #=> "base64"
- def transfer_encoding( default = nil )
- if h = @header['content-transfer-encoding']
- h.encoding || default
- else
- default
- end
- end
-
- # Destructively sets the transfer encoding of the mail object to the passed string, you
- # should note though that this does nothing to the mail body, just changes the header
- # value, you will need to encode or decode the body as well to match whatever you put
- # in this header value.
- #
- # Example:
- #
- # mail = TMail::Mail.new
- # mail.transfer_encoding #=> nil
- # mail.transfer_encoding = "base64"
- # mail.transfer_encoding #=> "base64"
- def transfer_encoding=( str )
- set_string_attr 'Content-Transfer-Encoding', str
- end
-
- alias encoding transfer_encoding
- alias encoding= transfer_encoding=
- alias content_transfer_encoding transfer_encoding
- alias content_transfer_encoding= transfer_encoding=
-
- # Returns the content-disposition of the mail object, returns nil or the passed
- # default value if given
- #
- # Example:
- #
- # mail = TMail::Mail.load("path_to/raw_mail_with_attachment")
- # mail.disposition #=> "attachment"
- #
- # mail = TMail::Mail.load("path_to/plain_simple_email")
- # mail.disposition #=> nil
- # mail.disposition(false) #=> false
- def disposition( default = nil )
- if h = @header['content-disposition']
- h.disposition || default
- else
- default
- end
- end
-
- alias content_disposition disposition
-
- # Allows you to set the content-disposition of the mail object. Accepts a type
- # and a hash of parameters.
- #
- # Example:
- #
- # mail.set_disposition("attachment", {:filename => "test.rb"})
- # mail.disposition #=> "attachment"
- # mail['content-disposition'].to_s #=> "attachment; filename=test.rb"
- def set_disposition( str, params = nil )
- if h = @header['content-disposition']
- h.disposition = str
- h.params.clear
- else
- store('Content-Disposition', str)
- h = @header['content-disposition']
- end
- h.params.replace params if params
- end
-
- alias disposition= set_disposition
- alias set_content_disposition set_disposition
- alias content_disposition= set_disposition
-
- # Returns the value of a parameter in an existing content-disposition header
- #
- # Example:
- #
- # mail.set_disposition("attachment", {:filename => "test.rb"})
- # mail['content-disposition'].to_s #=> "attachment; filename=test.rb"
- # mail.disposition_param("filename") #=> "test.rb"
- # mail.disposition_param("missing_param_key") #=> nil
- # mail.disposition_param("missing_param_key", false) #=> false
- # mail.disposition_param("missing_param_key", "Nothing to see here") #=> "Nothing to see here"
- def disposition_param( name, default = nil )
- if h = @header['content-disposition']
- h[name] || default
- else
- default
- end
- end
-
- # Convert the Mail object's body into a Base64 encoded email
- # returning the modified Mail object
- def base64_encode!
- store 'Content-Transfer-Encoding', 'Base64'
- self.body = base64_encode
- end
-
- # Return the result of encoding the TMail::Mail object body
- # without altering the current body
- def base64_encode
- Base64.folding_encode(self.body)
- end
-
- # Convert the Mail object's body into a Base64 decoded email
- # returning the modified Mail object
- def base64_decode!
- if /base64/i === self.transfer_encoding('')
- store 'Content-Transfer-Encoding', '8bit'
- self.body = base64_decode
- end
- end
-
- # Returns the result of decoding the TMail::Mail object body
- # without altering the current body
- def base64_decode
- Base64.decode(self.body, @config.strict_base64decode?)
- end
-
- # Returns an array of each destination in the email message including to: cc: or bcc:
- #
- # Example:
- #
- # mail.to = "Mikel "
- # mail.cc = "Trans "
- # mail.bcc = "bob "
- # mail.destinations #=> ["mikel@lindsaar.net", "t@t.com", "bob@me.com"]
- def destinations( default = nil )
- ret = []
- %w( to cc bcc ).each do |nm|
- if h = @header[nm]
- h.addrs.each {|i| ret.push i.address }
- end
- end
- ret.empty? ? default : ret
- end
-
- # Yields a block of destination, yielding each as a string.
- # (from the destinations example)
- # mail.each_destination { |d| puts "#{d.class}: #{d}" }
- # String: mikel@lindsaar.net
- # String: t@t.com
- # String: bob@me.com
- def each_destination( &block )
- destinations([]).each do |i|
- if Address === i
- yield i
- else
- i.each(&block)
- end
- end
- end
-
- alias each_dest each_destination
-
- # Returns an array of reply to addresses that the Mail object has,
- # or if the Mail message has no reply-to, returns an array of the
- # Mail objects from addresses. Else returns the default which can
- # either be passed as a parameter or defaults to nil
- #
- # Example:
- # mail.from = "Mikel "
- # mail.reply_to = nil
- # mail.reply_addresses #=> [""]
- #
- def reply_addresses( default = nil )
- reply_to_addrs(nil) or from_addrs(nil) or default
- end
-
- # Returns the "sender" field as an array -> useful to find out who to
- # send an error email to.
- def error_reply_addresses( default = nil )
- if s = sender(nil)
- [s]
- else
- from_addrs(default)
- end
- end
-
- # Returns true if the Mail object is a multipart message
- def multipart?
- main_type('').downcase == 'multipart'
- end
-
- # Creates a new email in reply to self. Sets the In-Reply-To and
- # References headers for you automagically.
- #
- # Example:
- # mail = TMail::Mail.load("my_email")
- # reply_email = mail.create_reply
- # reply_email.class #=> TMail::Mail
- # reply_email.references #=> [""]
- # reply_email.in_reply_to #=> [""]
- def create_reply
- setup_reply create_empty_mail()
- end
-
- # Creates a new email in reply to self. Sets the In-Reply-To and
- # References headers for you automagically.
- #
- # Example:
- # mail = TMail::Mail.load("my_email")
- # forward_email = mail.create_forward
- # forward_email.class #=> TMail::Mail
- # forward_email.content_type #=> "multipart/mixed"
- # forward_email.body #=> "Attachment: (unnamed)"
- # forward_email.encoded #=> Returns the original email as a MIME attachment
- def create_forward
- setup_forward create_empty_mail()
- end
-
- #:stopdoc:
- private
-
- def create_empty_mail
- self.class.new(StringPort.new(''), @config)
- end
-
- def setup_reply( mail )
- if tmp = reply_addresses(nil)
- mail.to_addrs = tmp
- end
-
- mid = message_id(nil)
- tmp = references(nil) || []
- tmp.push mid if mid
- mail.in_reply_to = [mid] if mid
- mail.references = tmp unless tmp.empty?
- mail.subject = 'Re: ' + subject('').sub(/\A(?:\[[^\]]+\])?(?:\s*Re:)*\s*/i, '')
- mail.mime_version = '1.0'
- mail
- end
-
- def setup_forward( mail )
- m = Mail.new(StringPort.new(''))
- m.body = decoded
- m.set_content_type 'message', 'rfc822'
- m.encoding = encoding('7bit')
- mail.parts.push m
- # call encoded to reparse the message
- mail.encoded
- mail
- end
-
- #:startdoc:
- end # class Mail
-
-end # module TMail
diff --git a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/loader.rb b/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/loader.rb
deleted file mode 100644
index 6c0e2511..00000000
--- a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/loader.rb
+++ /dev/null
@@ -1,3 +0,0 @@
-#:stopdoc:
-require 'tmail/mailbox'
-#:startdoc:
\ No newline at end of file
diff --git a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/mail.rb b/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/mail.rb
deleted file mode 100644
index 7074ed98..00000000
--- a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/mail.rb
+++ /dev/null
@@ -1,578 +0,0 @@
-=begin rdoc
-
-= Mail class
-
-=end
-#--
-# Copyright (c) 1998-2003 Minero Aoki
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-# Note: Originally licensed under LGPL v2+. Using MIT license for Rails
-# with permission of Minero Aoki.
-#++
-
-
-
-require 'tmail/interface'
-require 'tmail/encode'
-require 'tmail/header'
-require 'tmail/port'
-require 'tmail/config'
-require 'tmail/utils'
-require 'tmail/attachments'
-require 'tmail/quoting'
-require 'socket'
-
-module TMail
-
- # == Mail Class
- #
- # Accessing a TMail object done via the TMail::Mail class. As email can be fairly complex
- # creatures, you will find a large amount of accessor and setter methods in this class!
- #
- # Most of the below methods handle the header, in fact, what TMail does best is handle the
- # header of the email object. There are only a few methods that deal directly with the body
- # of the email, such as base64_encode and base64_decode.
- #
- # === Using TMail inside your code
- #
- # The usual way is to install the gem (see the {README}[link:/README] on how to do this) and
- # then put at the top of your class:
- #
- # require 'tmail'
- #
- # You can then create a new TMail object in your code with:
- #
- # @email = TMail::Mail.new
- #
- # Or if you have an email as a string, you can initialize a new TMail::Mail object and get it
- # to parse that string for you like so:
- #
- # @email = TMail::Mail.parse(email_text)
- #
- # You can also read a single email off the disk, for example:
- #
- # @email = TMail::Mail.load('filename.txt')
- #
- # Also, you can read a mailbox (usual unix mbox format) and end up with an array of TMail
- # objects by doing something like this:
- #
- # # Note, we pass true as the last variable to open the mailbox read only
- # mailbox = TMail::UNIXMbox.new("mailbox", nil, true)
- # @emails = []
- # mailbox.each_port { |m| @emails << TMail::Mail.new(m) }
- #
- class Mail
-
- class << self
-
- # Opens an email that has been saved out as a file by itself.
- #
- # This function will read a file non-destructively and then parse
- # the contents and return a TMail::Mail object.
- #
- # Does not handle multiple email mailboxes (like a unix mbox) for that
- # use the TMail::UNIXMbox class.
- #
- # Example:
- # mail = TMail::Mail.load('filename')
- #
- def load( fname )
- new(FilePort.new(fname))
- end
-
- alias load_from load
- alias loadfrom load
-
- # Parses an email from the supplied string and returns a TMail::Mail
- # object.
- #
- # Example:
- # require 'rubygems'; require 'tmail'
- # email_string =< # bodyport=nil>
- # mail.body
- # #=> "Hello there Mikel!\n\n"
- def parse( str )
- new(StringPort.new(str))
- end
-
- end
-
- def initialize( port = nil, conf = DEFAULT_CONFIG ) #:nodoc:
- @port = port || StringPort.new
- @config = Config.to_config(conf)
-
- @header = {}
- @body_port = nil
- @body_parsed = false
- @epilogue = ''
- @parts = []
-
- @port.ropen {|f|
- parse_header f
- parse_body f unless @port.reproducible?
- }
- end
-
- # Provides access to the port this email is using to hold it's data
- #
- # Example:
- # mail = TMail::Mail.parse(email_string)
- # mail.port
- # #=> #
- attr_reader :port
-
- def inspect
- "\#<#{self.class} port=#{@port.inspect} bodyport=#{@body_port.inspect}>"
- end
-
- #
- # to_s interfaces
- #
-
- public
-
- include StrategyInterface
-
- def write_back( eol = "\n", charset = 'e' )
- parse_body
- @port.wopen {|stream| encoded eol, charset, stream }
- end
-
- def accept( strategy )
- with_multipart_encoding(strategy) {
- ordered_each do |name, field|
- next if field.empty?
- strategy.header_name canonical(name)
- field.accept strategy
- strategy.puts
- end
- strategy.puts
- body_port().ropen {|r|
- strategy.write r.read
- }
- }
- end
-
- private
-
- def canonical( name )
- name.split(/-/).map {|s| s.capitalize }.join('-')
- end
-
- def with_multipart_encoding( strategy )
- if parts().empty? # DO NOT USE @parts
- yield
-
- else
- bound = ::TMail.new_boundary
- if @header.key? 'content-type'
- @header['content-type'].params['boundary'] = bound
- else
- store 'Content-Type', %
- end
-
- yield
-
- parts().each do |tm|
- strategy.puts
- strategy.puts '--' + bound
- tm.accept strategy
- end
- strategy.puts
- strategy.puts '--' + bound + '--'
- strategy.write epilogue()
- end
- end
-
- ###
- ### header
- ###
-
- public
-
- ALLOW_MULTIPLE = {
- 'received' => true,
- 'resent-date' => true,
- 'resent-from' => true,
- 'resent-sender' => true,
- 'resent-to' => true,
- 'resent-cc' => true,
- 'resent-bcc' => true,
- 'resent-message-id' => true,
- 'comments' => true,
- 'keywords' => true
- }
- USE_ARRAY = ALLOW_MULTIPLE
-
- def header
- @header.dup
- end
-
- # Returns a TMail::AddressHeader object of the field you are querying.
- # Examples:
- # @mail['from'] #=> #
- # @mail['to'] #=> #
- #
- # You can get the string value of this by passing "to_s" to the query:
- # Example:
- # @mail['to'].to_s #=> "mikel@test.com.au"
- def []( key )
- @header[key.downcase]
- end
-
- def sub_header(key, param)
- (hdr = self[key]) ? hdr[param] : nil
- end
-
- alias fetch []
-
- # Allows you to set or delete TMail header objects at will.
- # Examples:
- # @mail = TMail::Mail.new
- # @mail['to'].to_s # => 'mikel@test.com.au'
- # @mail['to'] = 'mikel@elsewhere.org'
- # @mail['to'].to_s # => 'mikel@elsewhere.org'
- # @mail.encoded # => "To: mikel@elsewhere.org\r\n\r\n"
- # @mail['to'] = nil
- # @mail['to'].to_s # => nil
- # @mail.encoded # => "\r\n"
- #
- # Note: setting mail[] = nil actually deletes the header field in question from the object,
- # it does not just set the value of the hash to nil
- def []=( key, val )
- dkey = key.downcase
-
- if val.nil?
- @header.delete dkey
- return nil
- end
-
- case val
- when String
- header = new_hf(key, val)
- when HeaderField
- ;
- when Array
- ALLOW_MULTIPLE.include? dkey or
- raise ArgumentError, "#{key}: Header must not be multiple"
- @header[dkey] = val
- return val
- else
- header = new_hf(key, val.to_s)
- end
- if ALLOW_MULTIPLE.include? dkey
- (@header[dkey] ||= []).push header
- else
- @header[dkey] = header
- end
-
- val
- end
-
- alias store []=
-
- # Allows you to loop through each header in the TMail::Mail object in a block
- # Example:
- # @mail['to'] = 'mikel@elsewhere.org'
- # @mail['from'] = 'me@me.com'
- # @mail.each_header { |k,v| puts "#{k} = #{v}" }
- # # => from = me@me.com
- # # => to = mikel@elsewhere.org
- def each_header
- @header.each do |key, val|
- [val].flatten.each {|v| yield key, v }
- end
- end
-
- alias each_pair each_header
-
- def each_header_name( &block )
- @header.each_key(&block)
- end
-
- alias each_key each_header_name
-
- def each_field( &block )
- @header.values.flatten.each(&block)
- end
-
- alias each_value each_field
-
- FIELD_ORDER = %w(
- return-path received
- resent-date resent-from resent-sender resent-to
- resent-cc resent-bcc resent-message-id
- date from sender reply-to to cc bcc
- message-id in-reply-to references
- subject comments keywords
- mime-version content-type content-transfer-encoding
- content-disposition content-description
- )
-
- def ordered_each
- list = @header.keys
- FIELD_ORDER.each do |name|
- if list.delete(name)
- [@header[name]].flatten.each {|v| yield name, v }
- end
- end
- list.each do |name|
- [@header[name]].flatten.each {|v| yield name, v }
- end
- end
-
- def clear
- @header.clear
- end
-
- def delete( key )
- @header.delete key.downcase
- end
-
- def delete_if
- @header.delete_if do |key,val|
- if Array === val
- val.delete_if {|v| yield key, v }
- val.empty?
- else
- yield key, val
- end
- end
- end
-
- def keys
- @header.keys
- end
-
- def key?( key )
- @header.key? key.downcase
- end
-
- def values_at( *args )
- args.map {|k| @header[k.downcase] }.flatten
- end
-
- alias indexes values_at
- alias indices values_at
-
- private
-
- def parse_header( f )
- name = field = nil
- unixfrom = nil
-
- while line = f.gets
- case line
- when /\A[ \t]/ # continue from prev line
- raise SyntaxError, 'mail is began by space' unless field
- field << ' ' << line.strip
-
- when /\A([^\: \t]+):\s*/ # new header line
- add_hf name, field if field
- name = $1
- field = $' #.strip
-
- when /\A\-*\s*\z/ # end of header
- add_hf name, field if field
- name = field = nil
- break
-
- when /\AFrom (\S+)/
- unixfrom = $1
-
- when /^charset=.*/
-
- else
- raise SyntaxError, "wrong mail header: '#{line.inspect}'"
- end
- end
- add_hf name, field if name
-
- if unixfrom
- add_hf 'Return-Path', "<#{unixfrom}>" unless @header['return-path']
- end
- end
-
- def add_hf( name, field )
- key = name.downcase
- field = new_hf(name, field)
-
- if ALLOW_MULTIPLE.include? key
- (@header[key] ||= []).push field
- else
- @header[key] = field
- end
- end
-
- def new_hf( name, field )
- HeaderField.new(name, field, @config)
- end
-
- ###
- ### body
- ###
-
- public
-
- def body_port
- parse_body
- @body_port
- end
-
- def each( &block )
- body_port().ropen {|f| f.each(&block) }
- end
-
- def quoted_body
- body_port.ropen {|f| return f.read }
- end
-
- def quoted_body= str
- body_port.wopen { |f| f.write str }
- str
- end
-
- def body=( str )
- # Sets the body of the email to a new (encoded) string.
- #
- # We also reparses the email if the body is ever reassigned, this is a performance hit, however when
- # you assign the body, you usually want to be able to make sure that you can access the attachments etc.
- #
- # Usage:
- #
- # mail.body = "Hello, this is\nthe body text"
- # # => "Hello, this is\nthe body"
- # mail.body
- # # => "Hello, this is\nthe body"
- @body_parsed = false
- parse_body(StringInput.new(str))
- parse_body
- @body_port.wopen {|f| f.write str }
- str
- end
-
- alias preamble quoted_body
- alias preamble= quoted_body=
-
- def epilogue
- parse_body
- @epilogue.dup
- end
-
- def epilogue=( str )
- parse_body
- @epilogue = str
- str
- end
-
- def parts
- parse_body
- @parts
- end
-
- def each_part( &block )
- parts().each(&block)
- end
-
- # Returns true if the content type of this part of the email is
- # a disposition attachment
- def disposition_is_attachment?
- (self['content-disposition'] && self['content-disposition'].disposition == "attachment")
- end
-
- # Returns true if this part's content main type is text, else returns false.
- # By main type is meant "text/plain" is text. "text/html" is text
- def content_type_is_text?
- self.header['content-type'] && (self.header['content-type'].main_type != "text")
- end
-
- private
-
- def parse_body( f = nil )
- return if @body_parsed
- if f
- parse_body_0 f
- else
- @port.ropen {|f|
- skip_header f
- parse_body_0 f
- }
- end
- @body_parsed = true
- end
-
- def skip_header( f )
- while line = f.gets
- return if /\A[\r\n]*\z/ === line
- end
- end
-
- def parse_body_0( f )
- if multipart?
- read_multipart f
- else
- @body_port = @config.new_body_port(self)
- @body_port.wopen {|w|
- w.write f.read
- }
- end
- end
-
- def read_multipart( src )
- bound = @header['content-type'].params['boundary'] || ::TMail.new_boundary
- is_sep = /\A--#{Regexp.quote bound}(?:--)?[ \t]*(?:\n|\r\n|\r)/
- lastbound = "--#{bound}--"
-
- ports = [ @config.new_preamble_port(self) ]
- begin
- f = ports.last.wopen
- while line = src.gets
- if is_sep === line
- f.close
- break if line.strip == lastbound
- ports.push @config.new_part_port(self)
- f = ports.last.wopen
- else
- f << line
- end
- end
- @epilogue = (src.read || '')
- ensure
- f.close if f and not f.closed?
- end
-
- @body_port = ports.shift
- @parts = ports.map {|p| self.class.new(p, @config) }
- end
-
- end # class Mail
-
-end # module TMail
diff --git a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/mailbox.rb b/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/mailbox.rb
deleted file mode 100644
index fe3e2c35..00000000
--- a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/mailbox.rb
+++ /dev/null
@@ -1,496 +0,0 @@
-=begin rdoc
-
-= Mailbox and Mbox interaction class
-
-=end
-#--
-# Copyright (c) 1998-2003 Minero Aoki
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-# Note: Originally licensed under LGPL v2+. Using MIT license for Rails
-# with permission of Minero Aoki.
-#++
-
-require 'tmail/port'
-require 'socket'
-require 'mutex_m'
-
-
-unless [].respond_to?(:sort_by)
-module Enumerable#:nodoc:
- def sort_by
- map {|i| [yield(i), i] }.sort {|a,b| a.first <=> b.first }.map {|i| i[1] }
- end
-end
-end
-
-
-module TMail
-
- class MhMailbox
-
- PORT_CLASS = MhPort
-
- def initialize( dir )
- edir = File.expand_path(dir)
- raise ArgumentError, "not directory: #{dir}"\
- unless FileTest.directory? edir
- @dirname = edir
- @last_file = nil
- @last_atime = nil
- end
-
- def directory
- @dirname
- end
-
- alias dirname directory
-
- attr_accessor :last_atime
-
- def inspect
- "#<#{self.class} #{@dirname}>"
- end
-
- def close
- end
-
- def new_port
- PORT_CLASS.new(next_file_name())
- end
-
- def each_port
- mail_files().each do |path|
- yield PORT_CLASS.new(path)
- end
- @last_atime = Time.now
- end
-
- alias each each_port
-
- def reverse_each_port
- mail_files().reverse_each do |path|
- yield PORT_CLASS.new(path)
- end
- @last_atime = Time.now
- end
-
- alias reverse_each reverse_each_port
-
- # old #each_mail returns Port
- #def each_mail
- # each_port do |port|
- # yield Mail.new(port)
- # end
- #end
-
- def each_new_port( mtime = nil, &block )
- mtime ||= @last_atime
- return each_port(&block) unless mtime
- return unless File.mtime(@dirname) >= mtime
-
- mail_files().each do |path|
- yield PORT_CLASS.new(path) if File.mtime(path) > mtime
- end
- @last_atime = Time.now
- end
-
- private
-
- def mail_files
- Dir.entries(@dirname)\
- .select {|s| /\A\d+\z/ === s }\
- .map {|s| s.to_i }\
- .sort\
- .map {|i| "#{@dirname}/#{i}" }\
- .select {|path| FileTest.file? path }
- end
-
- def next_file_name
- unless n = @last_file
- n = 0
- Dir.entries(@dirname)\
- .select {|s| /\A\d+\z/ === s }\
- .map {|s| s.to_i }.sort\
- .each do |i|
- next unless FileTest.file? "#{@dirname}/#{i}"
- n = i
- end
- end
- begin
- n += 1
- end while FileTest.exist? "#{@dirname}/#{n}"
- @last_file = n
-
- "#{@dirname}/#{n}"
- end
-
- end # MhMailbox
-
- MhLoader = MhMailbox
-
-
- class UNIXMbox
-
- class << self
- alias newobj new
- end
-
- # Creates a new mailbox object that you can iterate through to collect the
- # emails from with "each_port".
- #
- # You need to pass it a filename of a unix mailbox format file, the format of this
- # file can be researched at this page at {wikipedia}[link:http://en.wikipedia.org/wiki/Mbox]
- #
- # ==== Parameters
- #
- # +filename+: The filename of the mailbox you want to open
- #
- # +tmpdir+: Can be set to override TMail using the system environment's temp dir. TMail will first
- # use the temp dir specified by you (if any) or then the temp dir specified in the Environment's TEMP
- # value then the value in the Environment's TMP value or failing all of the above, '/tmp'
- #
- # +readonly+: If set to false, each email you take from the mail box will be removed from the mailbox.
- # default is *false* - ie, it *WILL* truncate your mailbox file to ZERO once it has read the emails out.
- #
- # ==== Options:
- #
- # None
- #
- # ==== Examples:
- #
- # # First show using readonly true:
- #
- # require 'ftools'
- # File.size("../test/fixtures/mailbox")
- # #=> 20426
- #
- # mailbox = TMail::UNIXMbox.new("../test/fixtures/mailbox", nil, true)
- # #=> #
- #
- # mailbox.each_port do |port|
- # mail = TMail::Mail.new(port)
- # puts mail.subject
- # end
- # #Testing mailbox 1
- # #Testing mailbox 2
- # #Testing mailbox 3
- # #Testing mailbox 4
- # require 'ftools'
- # File.size?("../test/fixtures/mailbox")
- # #=> 20426
- #
- # # Now show with readonly set to the default false
- #
- # mailbox = TMail::UNIXMbox.new("../test/fixtures/mailbox")
- # #=> #
- #
- # mailbox.each_port do |port|
- # mail = TMail::Mail.new(port)
- # puts mail.subject
- # end
- # #Testing mailbox 1
- # #Testing mailbox 2
- # #Testing mailbox 3
- # #Testing mailbox 4
- #
- # File.size?("../test/fixtures/mailbox")
- # #=> nil
- def UNIXMbox.new( filename, tmpdir = nil, readonly = false )
- tmpdir = ENV['TEMP'] || ENV['TMP'] || '/tmp'
- newobj(filename, "#{tmpdir}/ruby_tmail_#{$$}_#{rand()}", readonly, false)
- end
-
- def UNIXMbox.lock( fname )
- begin
- f = File.open(fname, 'r+')
- f.flock File::LOCK_EX
- yield f
- ensure
- f.flock File::LOCK_UN
- f.close if f and not f.closed?
- end
- end
-
- def UNIXMbox.static_new( fname, dir, readonly = false )
- newobj(fname, dir, readonly, true)
- end
-
- def initialize( fname, mhdir, readonly, static )
- @filename = fname
- @readonly = readonly
- @closed = false
-
- Dir.mkdir mhdir
- @real = MhMailbox.new(mhdir)
- @finalizer = UNIXMbox.mkfinal(@real, @filename, !@readonly, !static)
- ObjectSpace.define_finalizer self, @finalizer
- end
-
- def UNIXMbox.mkfinal( mh, mboxfile, writeback_p, cleanup_p )
- lambda {
- if writeback_p
- lock(mboxfile) {|f|
- mh.each_port do |port|
- f.puts create_from_line(port)
- port.ropen {|r|
- f.puts r.read
- }
- end
- }
- end
- if cleanup_p
- Dir.foreach(mh.dirname) do |fname|
- next if /\A\.\.?\z/ === fname
- File.unlink "#{mh.dirname}/#{fname}"
- end
- Dir.rmdir mh.dirname
- end
- }
- end
-
- # make _From line
- def UNIXMbox.create_from_line( port )
- sprintf 'From %s %s',
- fromaddr(), TextUtils.time2str(File.mtime(port.filename))
- end
-
- def UNIXMbox.fromaddr(port)
- h = HeaderField.new_from_port(port, 'Return-Path') ||
- HeaderField.new_from_port(port, 'From') ||
- HeaderField.new_from_port(port, 'EnvelopeSender') or return 'nobody'
- a = h.addrs[0] or return 'nobody'
- a.spec
- end
-
- def close
- return if @closed
-
- ObjectSpace.undefine_finalizer self
- @finalizer.call
- @finalizer = nil
- @real = nil
- @closed = true
- @updated = nil
- end
-
- def each_port( &block )
- close_check
- update
- @real.each_port(&block)
- end
-
- alias each each_port
-
- def reverse_each_port( &block )
- close_check
- update
- @real.reverse_each_port(&block)
- end
-
- alias reverse_each reverse_each_port
-
- # old #each_mail returns Port
- #def each_mail( &block )
- # each_port do |port|
- # yield Mail.new(port)
- # end
- #end
-
- def each_new_port( mtime = nil )
- close_check
- update
- @real.each_new_port(mtime) {|p| yield p }
- end
-
- def new_port
- close_check
- @real.new_port
- end
-
- private
-
- def close_check
- @closed and raise ArgumentError, 'accessing already closed mbox'
- end
-
- def update
- return if FileTest.zero?(@filename)
- return if @updated and File.mtime(@filename) < @updated
- w = nil
- port = nil
- time = nil
- UNIXMbox.lock(@filename) {|f|
- begin
- f.each do |line|
- if /\AFrom / === line
- w.close if w
- File.utime time, time, port.filename if time
-
- port = @real.new_port
- w = port.wopen
- time = fromline2time(line)
- else
- w.print line if w
- end
- end
- ensure
- if w and not w.closed?
- w.close
- File.utime time, time, port.filename if time
- end
- end
- f.truncate(0) unless @readonly
- @updated = Time.now
- }
- end
-
- def fromline2time( line )
- m = /\AFrom \S+ \w+ (\w+) (\d+) (\d+):(\d+):(\d+) (\d+)/.match(line) or return nil
- Time.local(m[6].to_i, m[1], m[2].to_i, m[3].to_i, m[4].to_i, m[5].to_i)
- rescue
- nil
- end
-
- end # UNIXMbox
-
- MboxLoader = UNIXMbox
-
-
- class Maildir
-
- extend Mutex_m
-
- PORT_CLASS = MaildirPort
-
- @seq = 0
- def Maildir.unique_number
- synchronize {
- @seq += 1
- return @seq
- }
- end
-
- def initialize( dir = nil )
- @dirname = dir || ENV['MAILDIR']
- raise ArgumentError, "not directory: #{@dirname}"\
- unless FileTest.directory? @dirname
- @new = "#{@dirname}/new"
- @tmp = "#{@dirname}/tmp"
- @cur = "#{@dirname}/cur"
- end
-
- def directory
- @dirname
- end
-
- def inspect
- "#<#{self.class} #{@dirname}>"
- end
-
- def close
- end
-
- def each_port
- mail_files(@cur).each do |path|
- yield PORT_CLASS.new(path)
- end
- end
-
- alias each each_port
-
- def reverse_each_port
- mail_files(@cur).reverse_each do |path|
- yield PORT_CLASS.new(path)
- end
- end
-
- alias reverse_each reverse_each_port
-
- def new_port
- fname = nil
- tmpfname = nil
- newfname = nil
-
- begin
- fname = "#{Time.now.to_i}.#{$$}_#{Maildir.unique_number}.#{Socket.gethostname}"
-
- tmpfname = "#{@tmp}/#{fname}"
- newfname = "#{@new}/#{fname}"
- end while FileTest.exist? tmpfname
-
- if block_given?
- File.open(tmpfname, 'w') {|f| yield f }
- File.rename tmpfname, newfname
- PORT_CLASS.new(newfname)
- else
- File.open(tmpfname, 'w') {|f| f.write "\n\n" }
- PORT_CLASS.new(tmpfname)
- end
- end
-
- def each_new_port
- mail_files(@new).each do |path|
- dest = @cur + '/' + File.basename(path)
- File.rename path, dest
- yield PORT_CLASS.new(dest)
- end
-
- check_tmp
- end
-
- TOO_OLD = 60 * 60 * 36 # 36 hour
-
- def check_tmp
- old = Time.now.to_i - TOO_OLD
-
- each_filename(@tmp) do |full, fname|
- if FileTest.file? full and
- File.stat(full).mtime.to_i < old
- File.unlink full
- end
- end
- end
-
- private
-
- def mail_files( dir )
- Dir.entries(dir)\
- .select {|s| s[0] != ?. }\
- .sort_by {|s| s.slice(/\A\d+/).to_i }\
- .map {|s| "#{dir}/#{s}" }\
- .select {|path| FileTest.file? path }
- end
-
- def each_filename( dir )
- Dir.foreach(dir) do |fname|
- path = "#{dir}/#{fname}"
- if fname[0] != ?. and FileTest.file? path
- yield path, fname
- end
- end
- end
-
- end # Maildir
-
- MaildirLoader = Maildir
-
-end # module TMail
diff --git a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/main.rb b/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/main.rb
deleted file mode 100644
index e5277279..00000000
--- a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/main.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-#:stopdoc:
-require 'tmail/version'
-require 'tmail/mail'
-require 'tmail/mailbox'
-require 'tmail/core_extensions'
-#:startdoc:
\ No newline at end of file
diff --git a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/mbox.rb b/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/mbox.rb
deleted file mode 100644
index 6c0e2511..00000000
--- a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/mbox.rb
+++ /dev/null
@@ -1,3 +0,0 @@
-#:stopdoc:
-require 'tmail/mailbox'
-#:startdoc:
\ No newline at end of file
diff --git a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/net.rb b/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/net.rb
deleted file mode 100644
index 1d87c307..00000000
--- a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/net.rb
+++ /dev/null
@@ -1,250 +0,0 @@
-#--
-# Copyright (c) 1998-2003 Minero Aoki
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-# Note: Originally licensed under LGPL v2+. Using MIT license for Rails
-# with permission of Minero Aoki.
-#++
-
-#:stopdoc:
-require 'nkf'
-#:startdoc:
-
-module TMail
-
- class Mail
-
- def send_to( smtp )
- do_send_to(smtp) do
- ready_to_send
- end
- end
-
- def send_text_to( smtp )
- do_send_to(smtp) do
- ready_to_send
- mime_encode
- end
- end
-
- def do_send_to( smtp )
- from = from_address or raise ArgumentError, 'no from address'
- (dests = destinations).empty? and raise ArgumentError, 'no receipient'
- yield
- send_to_0 smtp, from, dests
- end
- private :do_send_to
-
- def send_to_0( smtp, from, to )
- smtp.ready(from, to) do |f|
- encoded "\r\n", 'j', f, ''
- end
- end
-
- def ready_to_send
- delete_no_send_fields
- add_message_id
- add_date
- end
-
- NOSEND_FIELDS = %w(
- received
- bcc
- )
-
- def delete_no_send_fields
- NOSEND_FIELDS.each do |nm|
- delete nm
- end
- delete_if {|n,v| v.empty? }
- end
-
- def add_message_id( fqdn = nil )
- unless @message_id_enforced
- self.message_id = ::TMail::new_message_id(fqdn)
- end
- end
-
- def add_date
- self.date = Time.now
- end
-
- def mime_encode
- if parts.empty?
- mime_encode_singlepart
- else
- mime_encode_multipart true
- end
- end
-
- def mime_encode_singlepart
- self.mime_version = '1.0'
- b = body
- if NKF.guess(b) != NKF::BINARY
- mime_encode_text b
- else
- mime_encode_binary b
- end
- end
-
- def mime_encode_text( body )
- self.body = NKF.nkf('-j -m0', body)
- self.set_content_type 'text', 'plain', {'charset' => 'iso-2022-jp'}
- self.encoding = '7bit'
- end
-
- def mime_encode_binary( body )
- self.body = [body].pack('m')
- self.set_content_type 'application', 'octet-stream'
- self.encoding = 'Base64'
- end
-
- def mime_encode_multipart( top = true )
- self.mime_version = '1.0' if top
- self.set_content_type 'multipart', 'mixed'
- e = encoding(nil)
- if e and not /\A(?:7bit|8bit|binary)\z/i === e
- raise ArgumentError,
- 'using C.T.Encoding with multipart mail is not permitted'
- end
- end
-
- end
-
- #:stopdoc:
- class DeleteFields
-
- NOSEND_FIELDS = %w(
- received
- bcc
- )
-
- def initialize( nosend = nil, delempty = true )
- @no_send_fields = nosend || NOSEND_FIELDS.dup
- @delete_empty_fields = delempty
- end
-
- attr :no_send_fields
- attr :delete_empty_fields, true
-
- def exec( mail )
- @no_send_fields.each do |nm|
- delete nm
- end
- delete_if {|n,v| v.empty? } if @delete_empty_fields
- end
-
- end
- #:startdoc:
-
- #:stopdoc:
- class AddMessageId
-
- def initialize( fqdn = nil )
- @fqdn = fqdn
- end
-
- attr :fqdn, true
-
- def exec( mail )
- mail.message_id = ::TMail::new_msgid(@fqdn)
- end
-
- end
- #:startdoc:
-
- #:stopdoc:
- class AddDate
-
- def exec( mail )
- mail.date = Time.now
- end
-
- end
- #:startdoc:
-
- #:stopdoc:
- class MimeEncodeAuto
-
- def initialize( s = nil, m = nil )
- @singlepart_composer = s || MimeEncodeSingle.new
- @multipart_composer = m || MimeEncodeMulti.new
- end
-
- attr :singlepart_composer
- attr :multipart_composer
-
- def exec( mail )
- if mail._builtin_multipart?
- then @multipart_composer
- else @singlepart_composer end.exec mail
- end
-
- end
- #:startdoc:
-
- #:stopdoc:
- class MimeEncodeSingle
-
- def exec( mail )
- mail.mime_version = '1.0'
- b = mail.body
- if NKF.guess(b) != NKF::BINARY
- on_text b
- else
- on_binary b
- end
- end
-
- def on_text( body )
- mail.body = NKF.nkf('-j -m0', body)
- mail.set_content_type 'text', 'plain', {'charset' => 'iso-2022-jp'}
- mail.encoding = '7bit'
- end
-
- def on_binary( body )
- mail.body = [body].pack('m')
- mail.set_content_type 'application', 'octet-stream'
- mail.encoding = 'Base64'
- end
-
- end
- #:startdoc:
-
- #:stopdoc:
- class MimeEncodeMulti
-
- def exec( mail, top = true )
- mail.mime_version = '1.0' if top
- mail.set_content_type 'multipart', 'mixed'
- e = encoding(nil)
- if e and not /\A(?:7bit|8bit|binary)\z/i === e
- raise ArgumentError,
- 'using C.T.Encoding with multipart mail is not permitted'
- end
- mail.parts.each do |m|
- exec m, false if m._builtin_multipart?
- end
- end
-
- end
- #:startdoc:
-end # module TMail
diff --git a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/obsolete.rb b/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/obsolete.rb
deleted file mode 100644
index 22b0a126..00000000
--- a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/obsolete.rb
+++ /dev/null
@@ -1,132 +0,0 @@
-=begin rdoc
-
-= Obsolete methods that are depriciated
-
-If you really want to see them, go to lib/tmail/obsolete.rb and view to your
-heart's content.
-
-=end
-#--
-# Copyright (c) 1998-2003 Minero Aoki
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-# Note: Originally licensed under LGPL v2+. Using MIT license for Rails
-# with permission of Minero Aoki.
-#++
-#:stopdoc:
-module TMail #:nodoc:
-
- class Mail
- alias include? key?
- alias has_key? key?
-
- def values
- ret = []
- each_field {|v| ret.push v }
- ret
- end
-
- def value?( val )
- HeaderField === val or return false
-
- [ @header[val.name.downcase] ].flatten.include? val
- end
-
- alias has_value? value?
- end
-
- class Mail
- def from_addr( default = nil )
- addr, = from_addrs(nil)
- addr || default
- end
-
- def from_address( default = nil )
- if a = from_addr(nil)
- a.spec
- else
- default
- end
- end
-
- alias from_address= from_addrs=
-
- def from_phrase( default = nil )
- if a = from_addr(nil)
- a.phrase
- else
- default
- end
- end
-
- alias msgid message_id
- alias msgid= message_id=
-
- alias each_dest each_destination
- end
-
- class Address
- alias route routes
- alias addr spec
-
- def spec=( str )
- @local, @domain = str.split(/@/,2).map {|s| s.split(/\./) }
- end
-
- alias addr= spec=
- alias address= spec=
- end
-
- class MhMailbox
- alias new_mail new_port
- alias each_mail each_port
- alias each_newmail each_new_port
- end
- class UNIXMbox
- alias new_mail new_port
- alias each_mail each_port
- alias each_newmail each_new_port
- end
- class Maildir
- alias new_mail new_port
- alias each_mail each_port
- alias each_newmail each_new_port
- end
-
- extend TextUtils
-
- class << self
- alias msgid? message_id?
- alias boundary new_boundary
- alias msgid new_message_id
- alias new_msgid new_message_id
- end
-
- def Mail.boundary
- ::TMail.new_boundary
- end
-
- def Mail.msgid
- ::TMail.new_message_id
- end
-
-end # module TMail
-#:startdoc:
\ No newline at end of file
diff --git a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/parser.rb b/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/parser.rb
deleted file mode 100644
index 1d4dcc2f..00000000
--- a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/parser.rb
+++ /dev/null
@@ -1,1060 +0,0 @@
-#
-# DO NOT MODIFY!!!!
-# This file is automatically generated by racc 1.4.5
-# from racc grammer file "lib/tmail/parser.y".
-#
-
-require 'racc/parser'
-
-
-#
-# parser.rb
-#
-# Copyright (c) 1998-2007 Minero Aoki
-#
-# This program is free software.
-# You can distribute/modify this program under the terms of
-# the GNU Lesser General Public License version 2.1.
-#
-
-require 'tmail/scanner'
-require 'tmail/utils'
-
-
-module TMail
-
- class Parser < Racc::Parser
-
-module_eval <<'..end lib/tmail/parser.y modeval..id2dd1c7d21d', 'lib/tmail/parser.y', 340
-
- include TextUtils
-
- def self.parse( ident, str, cmt = nil )
- str = special_quote_address(str) if ident.to_s =~ /M?ADDRESS/
- new.parse(ident, str, cmt)
- end
-
- def self.special_quote_address(str) #:nodoc:
- # Takes a string which is an address and adds quotation marks to special
- # edge case methods that the RACC parser can not handle.
- #
- # Right now just handles two edge cases:
- #
- # Full stop as the last character of the display name:
- # Mikel L.
- # Returns:
- # "Mikel L."
- #
- # Unquoted @ symbol in the display name:
- # mikel@me.com
- # Returns:
- # "mikel@me.com"
- #
- # Any other address not matching these patterns just gets returned as is.
- case
- # This handles the missing "" in an older version of Apple Mail.app
- # around the display name when the display name contains a '@'
- # like 'mikel@me.com '
- # Just quotes it to: '"mikel@me.com" '
- when str =~ /\A([^"].+@.+[^"])\s(<.*?>)\Z/
- return "\"#{$1}\" #{$2}"
- # This handles cases where 'Mikel A. ' which is a trailing
- # full stop before the address section. Just quotes it to
- # '"Mikel A."