Permalink
Browse files

updated layout and added /about page

  • Loading branch information...
pmenglund committed Nov 30, 2011
1 parent 36025c2 commit ce68c8e907f8c8ac578b240726799a5d5cfed891
Showing with 60 additions and 13 deletions.
  1. +21 −7 app.rb
  2. +26 −0 views/about.haml
  3. +6 −3 views/index.haml
  4. +4 −2 views/layout.haml
  5. +3 −1 views/stylesheet.sass
View
28 app.rb
@@ -29,16 +29,26 @@
DataMapper.setup(:default, options)
DataMapper.finalize
- # TODO ugly hack - move into a separate app
- Thread.new do
- while true
- puts "pulling feeds..."
- FEEDS.each do |feed|
- FeedzirraRedis::Feed.fetch_and_parse(feed)
+ # TODO ugly hack - move into a separate app and run hourly using clockwork
+ index = 0
+ if app_env = ENV['VCAP_APPLICATION']
+ json = JSON.parse(app_env)
+ index = json['instance_index']
+ end
+
+ # only start the update thread on the first instance
+ if index == 0
+ Thread.new do
+ while true
+ puts "pulling feeds..."
+ FEEDS.each do |feed|
+ FeedzirraRedis::Feed.fetch_and_parse(feed)
+ end
+ sleep 600
end
- sleep 600
end
end
+
end
get '/' do
@@ -51,6 +61,10 @@
sass :stylesheet
end
+get '/about' do
+ haml :about
+end
+
get '/feed' do
# TODO caching
@entries = FeedzirraRedis::Entry.all(:order => [:published.desc])
View
@@ -0,0 +1,26 @@
+%h1
+ About Planet Cloud Foundry
+
+%p
+ This blog feed aggregator uses
+ %a{:href => "https://github.com/pauldix/feedzirra"} feedzirra
+ to load external feeds and then store them in
+ %a{:href => "http://redis.io/"} Redis.
+ All of that code was blatantly stolen from
+ %a{:href => "https://github.com/logankoester/feedzirra-redis"} feedzirra-redis
+ but as I had to change some small things I pulled in all code instead of forking
+
+%p
+ I know there are much better
+ %a{:href => "http://www.feedburner.com"} feed aggregators
+ out there,
+ but this is supposed to serve as sample code how to use
+ %a{:href => "http://www.sinatrarb.com/"} Sinatra
+ on
+ %a{:href => "http://cloudfoundry.com/"} Cloud Foundry
+
+%p
+ If you think that a blog is missing,
+ just let
+ %a{:href => "mailto:martin@englund.nu"} me
+ know and I'll add it.
View
@@ -1,9 +1,12 @@
#header
%h1 Planet Cloud Foundry
%p
- Blog feed aggregator for
- %a{:href => "http://cloudfoundry.com/"} Cloud Foundry
- related blogs
+ Blog feed aggregator for
+ %a{:href => "http://cloudfoundry.com/"} Cloud Foundry
+ related blogs - running on Cloud Foundry
+ %p
+ You can subscribe to the
+ %a{:href => "/feed"} RSS feed
- @entries.each do |entry|
#entry
View
@@ -7,7 +7,9 @@
= yield
#footer
+ %a{:href => "/about"} About
Planet Cloud Foundry by
%a{:href => "http://blog.codenursery.com/"} Martin Englund
- |
- %a{:href => "https://github.com/pmenglund/planet-cf"} Source Code
+ %br
+ Source code available on
+ %a{:href => "https://github.com/pmenglund/planet-cf"} github
View
@@ -8,10 +8,12 @@ pre
:padding 3px
#entry
- :background-color #cccccc
:border-color #aaa
:border-width 1px
:border-style solid
:padding-left 10px
:padding-right 10px
:margin-top 10px
+
+#footer
+ :text-align center

0 comments on commit ce68c8e

Please sign in to comment.