Skip to content
A sample app using Clockwork with a Rails/DJ app to fetch market prices periodically
Ruby JavaScript
Find file
Latest commit a68c038 Jun 30, 2010 @adamwiggins readme
Failed to load latest commit information.
app marketpoints fetched on a clock Jun 29, 2010
config marketpoints fetched on a clock Jun 29, 2010
db marketpoints fetched on a clock Jun 29, 2010
doc init Jun 29, 2010
lib marketpoints fetched on a clock Jun 29, 2010
public marketpoints fetched on a clock Jun 29, 2010
script init Jun 29, 2010
test marketpoints fetched on a clock Jun 29, 2010
vendor/plugins init Jun 29, 2010
.gitignore init Jun 29, 2010
Gemfile marketpoints fetched on a clock Jun 29, 2010
Procfile marketpoints fetched on a clock Jun 29, 2010
README.md readme Jun 30, 2010
Rakefile init Jun 29, 2010
config.ru init Jun 29, 2010

README.md

Sample Clockwork App (Rails/DJ)

Clockwork is a library to replace cron for scheduling jobs from within an application. This is a sample application which uses the Rails 3 web framework, a SQLite database, and the Delayed Job queueing system to demonstrate Clockwork's use.

The app fetches the Dow Jones index from Google Finance once every three minutes, and puts the results in the SQLite database. The web app shows the history of all fetched data points.

Prerequistes

  • Ruby
  • Bundler (gem install bundler)
  • SQLite3 (brew install sqlite)

Setup

$ git clone git://github.com/adamwiggins/clockwork-rails-dj.git
$ cd clockwork-rails-dj
$ bundle install
$ bundle exec rake db:migrate

Running the app

$ bundle exec rails server &
$ bundle exec rake jobs:work & 
$ bundle exec clockwork app/clock.rb &

Alternately, use Foreman (gem install foreman):

$ foreman start

Visit http://localhost:3000/ and you should see the first data point.

Something went wrong with that request. Please try again.