Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save davidwparker/9310 to your computer and use it in GitHub Desktop.
Save davidwparker/9310 to your computer and use it in GitHub Desktop.
rspec ubiquity search
CmdUtils.CreateCommand(
{
name: "rspec",
takes: {"function": noun_arb_text},
icon: "http://ruby-doc.org/favicon.ico",
homepage: "http://davidwparker.com",
author: {name: "Jack Dempsey, fork by David Parker", email: "[email protected]"},
license: "MPL,GPL",
description: "Search rspec functions documentation",
help: "Select a rspec function",
execute: function(directObject)
{
var url = "http://apidock.com/rspec/search?query={QUERY}&commit=Search"
var urlString = url.replace("{QUERY}", directObject.text);
Utils.openUrlInBrowser(urlString);
},
preview: function(pblock, directObject)
{
searchText = jQuery.trim(directObject.text);
if(searchText.length <= 0)
{
pblock.innerHTML = "Search rspec function documentation";
return;
}
var previewTemplate = "Search rspec function documentation of ${query}";
var previewData = {query: searchText};
pblock.innerHTML = CmdUtils.renderTemplate(previewTemplate, previewData);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment