17 Dec 2013

Donoku


I poked around at my first Sinatra project the other day: Donoku. It's a simple two-page site to take donations through Stripe Checkout. It's built to be deployed to Heroku & forces SSL, since Heroku gives its "appname.herokuapp.com" domains SSL access for free.

I've already used Donoku twice on my own! Once to accept donations for CityStrides, and once to accept donations for my campaign to be Holyoke's Ward 6 City Councilor.

To force SSL, I used the rack-ssl-enforcer gem. It's really simple to use... Just add the gem to your Gemfile, then require it in your app.rb file & add a single line to require SSL everywhere outside of localhost & the test environment:

  require 'rack/ssl-enforcer'
  use Rack::SslEnforcer, except_hosts: /127.0.0.1$/, :except_environments => 'test'
  
You can see it in action at the top of Donoku's app.rb file.

There's a little bit of a MailChimp integration, as well. After the donation goes through, people are directed to the 'thank you' page that includes a mailing list signup form. There's nothing crazy going on, but it works.

It's also one of my first attempts at using MiniTest instead of rspec. I like it just fine, but the familiarity that I have with rspec keeps me moving faster & the abundence of rspec documentation online gets me un-stuck quicker. I'm glad I tried it, but I'll be sticking with rspec (and might even switch Donoku over at some point).

Tags

donoku heroku mailchimp minitest sinatra stripe

Related Posts

28 Dec 2012 How to make SublimeLinter work with Ruby & RVM
09 Dec 2012 The tech behind getting Blizzalert into its third season
03 Nov 2012 Little-Corner is now a Heroku-ready Rails app
14 Oct 2012 Sip as a replacement for Pick as a replacement for Digital Color Meter in Mac OS X
08 Oct 2012 Launch Soon is a Heroku-ready viral Coming Soon page