Skip to content

Instantly share code, notes, and snippets.

@jeffkreeftmeijer
Created February 14, 2011 13:08
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jeffkreeftmeijer/825847 to your computer and use it in GitHub Desktop.
Save jeffkreeftmeijer/825847 to your computer and use it in GitHub Desktop.
Lighthouse Keeper: turns Lighthouse API XML into RSS - http://keeper.jeffkreeftmeijer.com
class Application < Sinatra::Base
get '/:domain/:project' do
tickets = HTTParty.get(
"https://#{params[:domain]}.lighthouseapp.com/projects/#{params[:project]}/tickets.xml?q=#{params[:q]}"
)['tickets']
builder do |xml|
xml.instruct! :xml, :version => '1.0'
xml.rss :version => "2.0" do
xml.channel do
xml.title "Lighthouse Keeper (#{params[:domain]}/#{params[:project]}/#{params[:q]})"
xml.link "https://#{params[:domain]}.lighthouseapp.com/projects/#{params[:project]}/tickets?q=#{params[:q]}"
tickets.each do |ticket|
xml.item do
xml.title "[#{ticket['number']}] #{ticket['title']}"
xml.link ticket['url']
xml.description ticket['original_body_html']
xml.pubDate Time.parse(ticket['created_at'].to_s).rfc822()
xml.guid ticket['url']
end
end
end
end
end
end
end
require 'sinatra'
require 'httparty'
require 'builder'
require './application'
run Application
<style>
div.container{
width:600px;
margin: 50px auto;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
p#by{
text-align:right;
float:right;
}
div#ad{
float:left;
}
p#by, div#ad{
font-size: 12px;
}
div#footer{
margin: 20px 10px 10px 0;
}
hr{
visibility: hidden;
clear: both;
}
</style>
<html>
<head>
<title>Keeper</title>
</head>
<body>
<div class="container">
<h1>Keeper</h1>
<h2>Lighthouse RSS from the future</h2>
<p>Keeper is a stupid-simple <a href="http://www.sinatrarb.com">Sinatra</a> app built to give you RSS feeds for <a href="http://lighthouseapp.com/">Lighthouse</a>.</p>
<h3>Example</h3>
<p>The RSS feed for <a href="https://rails.lighthouseapp.com/projects/8994/tickets?q=sort:number-">https://rails.lighthouseapp.com/projects/8994/tickets?q=sort:number-</a>, can be found at <a href="http://keeper.jeffkreeftmeijer.com/rails/8994?q=sort:number-">http://keeper.jeffkreeftmeijer.com/rails/8994?q=sort:number-</a>. Simply change the subdomain (rails) and the project id (8994) to your project's. Check out <a href="http://help.lighthouseapp.com/kb/getting-started/how-do-i-search-for-tickets">&ldquo;How do I search for tickets?&rdquo;</a> for more information about querying.</p>
<p>Keeper is a <a href="https://gist.github.com/825847">gist</a>. If you want to add anything, just fork it and let me know.</p>
<div id="footer">
<p id="by">
by <a href="http://jeffkreeftmeijer.com">Jeff Kreeftmeijer</a>
<p>
<div id="ad">
<div id="adzerk_ad_div">
<script src="http://engine.rubyrow.net/Server/RUBY/JK/HORIZ" type="text/javascript"></script>
</div>
<p>
Ads from
<a href="http://rubyrow.net">Rubyrow</a>
</p>
</div>
<hr/>
</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment