Fewer Onion
Ruby HTML
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
config
lib
site
spec
.gitignore
.rspec
Gemfile
Gemfile.lock
README.md
Rakefile

README.md

Fewer Onion

An automated Twitter account that retweets @theonion - find out more at the website or just follow @feweronion.

Deploying the site

The /site folder contains the couple files that makeup the website, so deploying that part is as easy as cloning down the project and then going through virtual host setup. The thing that's different is that instead of the content living in /var/www, it lives here and is just rsynced over using the deploy rake task.

Setting up the bot

The "bot" is really a few things:

  • a crontab entry that executes a rake task every 10 minutes
  • a postgres database to store which urls have been retweetd

Start by copying the config files:

$ cp config/database.example.yml config/database.yml
$ cp config/twitter.example.yml config/twitter.yml

You'll want to grab the Twitter keys from another machine where this project has been setup. For the postgres setup, just use the username for the server user and probably no password.

Next you'll have to create and migrate your Postgres database:

$ createdb fewer_onion
$ rake migrate

Finally, setup cron like this:

*/10 * * * * cd ~/code/fewer_onion && /usr/local/bin/rake update >> cron.log

Note: this assumes where you cloned the project - if that's different, you'll need to update that crontab.

Running tests

The project uses rspec and has the default rake task setup to run all tests:

$ rake

But before you do that, make sure that you've got a test database:

$ createdb fewer_onion_test
$ rake migrate FEWER_ONION_ENV=test