An open API service indexing awesome lists of open source software.

https://github.com/feedreader/pluto.live.starter

planet starter example site - sinatra web app in ruby using the pluto gem
https://github.com/feedreader/pluto.live.starter

Last synced: 3 months ago
JSON representation

planet starter example site - sinatra web app in ruby using the pluto gem

Awesome Lists containing this project

README

        

# pluto.live.starter

Example planet starter site - a Sinatra web app in Ruby
using the [pluto gem](https://github.com/feedreader/pluto).

```ruby
class Planet < Sinatra::Base

##########
# Models

include Pluto::Models # e.g. Feed, Item, Site, etc.

############################################
# Controllers / Routing / Request Handlers

get '/' do
erb :index
end

end
```

(Source: [`planet.rb`](planet.rb))

Sample template snippet:

```html

<%= site.title %>

<% site.items.latest.limit(24).each do |item| %>


<%= link_to item.feed.title, item.feed.url %>


<%= link_to item.title, item.url %>


<%= item.summary %>

<% end %>
```

(Source: [`views/index.erb`](views/index.erb))

## Live Demos

See the [Planet Ruby](http://plutopluto.herokuapp.com)
running on Heroku.

## Setup

### Setup on your local machine

Clone the pluto.live.starter git repo:

$ git clone git://github.com/feedreader/pluto.live.starter.git

Get all your Ruby libraries (gems) installed using the bundler tool:

$ cd pluto.live.starter
$ bundle install --without production

Note, use the `--without production` option for local development
unless you want to install the PostgreSQL (pg) database libraries
and services (required for production on the Heroku hosting service.)

Setup the database and planet feed subscriptions:

$ rake setup PLANET=ruby

Update your planet feeds:

$ rake update

Showtime! Startup the web server:

$ rackup

That's it.

### Setup on Heroku

Clone the pluto.live.starter git repo:

$ git clone git://github.com/feedreader/pluto.live.starter.git

Create app on Heroku e.g.

$ cd pluto.live.starter
$ heroku create

Upload via

$ git push heroku master

Add the PostgreSQL addon

$ heroku addons:add heroku-postgresql:dev

Establish primary database (that is, set DATABASE_URL). Find your POSTGRESQL_URL:

$ heroku config | grep HEROKU_POSTGRESQL

And promote HEROKU_POSTGRESQL__URL to DATABASE_URL:

$ heroku pg:promote HEROKU_POSTGRESQL__URL

Create database andd add planet feed subscriptions on first upload via

$ heroku run rake setup PLANET=ruby

Update feeds

$ heroku run rake update

Showtime! That's it.

Bonus:

Add a scheduler job to update feeds via `rake update` hourly, daily, etc.

## License

![](https://publicdomainworks.github.io/buttons/zero88x31.png)

The `pluto` scripts are dedicated to the public domain.
Use it as you please with no restrictions whatsoever.

## Questions? Comments?

Send them along to the [wwwmake Forum/Mailing List](http://groups.google.com/group/wwwmake).
Thanks!