Created
October 25, 2011 10:21
-
-
Save tomykaira/1312172 to your computer and use it in GitHub Desktop.
Create a new project with clockwork for heroku.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Licence: MIT | |
# Created by tomykaira, 2011-10-25 | |
if [ $# -ne 1 ]; then | |
echo "Give me your new project name (only)" | |
exit 1 | |
fi | |
mkdir $1 | |
if [ $? -ne 0 ]; then | |
echo "Could not create a new directory" | |
exit 1 | |
fi | |
cd $1 | |
cat > Gemfile <<EOF | |
source :rubygems | |
gem 'clockwork' | |
EOF | |
cat > clock.rb <<EOF | |
require 'rubygems' | |
require 'clockwork' | |
include Clockwork | |
handler do |job| | |
# do something | |
end | |
every(1.day, 'job_name') | |
EOF | |
echo "/.bundle" > .gitignore | |
echo "clock: bundle exec clockwork clock.rb" > Procfile | |
cat <<EOF | |
What's next: | |
$ cd $1 | |
$ git init & git add . & git commit | |
$ bundle install --path bundle/gems | |
Customize clock.rb | |
$ bundle exec clockwork clock.rb | |
$ heroku create $1 --stack cedar | |
$ git push heroku master | |
$ heroku scale clock=1 | |
Yah!! | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment