public
Last active

Lighthouse Keeper: turns Lighthouse API XML into RSS - http://keeper.jeffkreeftmeijer.com

  • Download Gist
application.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
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
config.ru
Ruby
1 2 3 4 5
require 'sinatra'
require 'httparty'
require 'builder'
require './application'
run Application
public/index.html
HTML
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
<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>

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.