Punchcard¶ ↑
A simple Sinatra app that lets you track who is and has been in the office at what times.
Bootstrap¶ ↑
Create a directory to hold your app, then create a Gemfile:
source :rubygems gem 'pg' # gem 'sqlite3' # if you want to run using sqlite or test locally gem 'punchcard'
Create a Rakefile:
require 'bundler' require 'rake' Bundler.require require 'punchcard/tasks'
Create a config.ru for rack:
require 'bundler' Bundler.require # You'll surely want to secure your punch card from general web access. The simplest way to do so is by # using the rack auth middleware, defining it somewhere in your config.ru: Punchcard::App.use Rack::Auth::Basic do |username, password| [username, password] == ['someuser', 'secret'] end run Punchcard::App
To run locally, make sure you have a proper ENV configured or the sqlite3 gem installed with your bundle. Then:
$ bundle install $ rake db:migrate $ rackup
Open localhost:9292
Supported Ruby versions¶ ↑
Punchcard is tested against MRI 1.8.7, 1.9.1, 1.9.2 and Ruby Enterprise Edition.
Hosting on Heroku¶ ↑
Starting from the initial bootstrap above, make sure you have the pg gem in your bundle and did run bundle install to create the Gemfile.lock, then do the following in the terminal:
$ git init && git add . $ git commit -m "Initial commit" $ heroku create [APPNAME] --stack bamboo-mri-1.9.2 $ git push heroku master $ heroku rake db:migrate
Now head over to your app’s url! You’ll still need to add users, see below.
Adding people¶ ↑
Currently, you’ll have to add users directly from the console. After creating your app on heroku, you can do so by running
$ heroku console > Person.create!(:name => 'Forrest Gump', :email => 'forrest@shrimpco.org')
Note on Patches/Pull Requests¶ ↑
-
Fork the project.
-
Make your feature addition or bug fix.
-
Add tests for it. This is important so I don’t break it in a future version unintentionally.
-
Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
-
Send me a pull request. Bonus points for topic branches.
Copyright¶ ↑
Copyright © 2010 Christoph Olszowka. See LICENSE for details.